text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
# See LICENSE.txt for licensing terms
from StringIO import StringIO
from docutils import writers
from rst2pdf import createpdf
class PdfWriter(writers.Writer):
def __init__(self, builder):
writers.Writer.__init__(self)
self.builder = builder
self.output = u''
... | liuyi1112/rst2pdf | rst2pdf/writer.py | Python | mit | 860 | 0 |
#!/usr/bin/env python
# **********************************************************************
#
# Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved.
#
# **********************************************************************
import sys, traceback, Ice
slice_dir = Ice.getSliceDir()
if not slice_dir:
print(sy... | qiuxs/ice-demos | python/Ice/properties/Client.py | Python | gpl-2.0 | 3,232 | 0.003403 |
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Sets environment variables needed to run a chromium unit test."""
import os
import stat
import subprocess
import sys
# This is... | Teamxrtc/webrtc-streaming-node | third_party/webrtc/src/chromium/src/testing/test_env.py | Python | mit | 8,248 | 0.013337 |
import random
from pdcglobal import *
from effects import *
def PotionOfKillbeePoison(item):
item.full_name += ' of Killerbee-Poison'
item.weaponinfotext = 'Dangerous Poison'
def DrinkPotionOfKillbeePoison(self, actor):
KillerbeePoisonEffect(actor,None)
def PotionOfYumuraPoison(item):
item.full_name ... | cycladesnz/chambersAndCreatures | src/item/suf_potions.py | Python | gpl-2.0 | 1,217 | 0.013969 |
# vi:si:et:sw=4:sts=4:ts=4
# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007,2008,2009 Fluendo, S.L.
# Copyright (C) 2010,2011 Flumotion Services, S.A.
# All rights reserved.
#
# This file may be distributed and/or modified under the terms of
# the GNU Lesser General Public License version 2.1... | osiloke/Flumotion-Transcoder | flumotion/transcoder/admin/adminconsts.py | Python | lgpl-2.1 | 5,673 | 0.000353 |
# -*- coding: utf-8 -*-
# python-holidays
# ---------------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: dr-prodigy <maurizio.... | ryanss/holidays.py | test/countries/test_nicaragua.py | Python | mit | 1,698 | 0 |
# -*- coding: utf-8 -*-
##
##
## This file is part of Indico.
## Copyright (C) 2002 - 2014 European Organization for Nuclear Research (CERN).
##
## Indico is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; eith... | Ictp/indico | indico/MaKaC/plugins/Collaboration/CERNMCU/options.py | Python | gpl-3.0 | 5,215 | 0.011697 |
# (C) 2012, Michael DeHaan, <michael.dehaan@gmail.com>
# This file is part of Ansible
#
# Ansible 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 lat... | shlomozippel/ansible | plugins/callbacks/log_plays.py | Python | gpl-3.0 | 3,121 | 0.001922 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
r"""
# .---. .-----------
# / \ __ / ------
# / / \( )/ ----- (`-') _ _(`-') <-. (`-')_
# ////// '\/ ` --- ( OO).-/( (OO ).-> .-> \( OO) ) .->
# //// / // : : --- (,------... | edonyM/emthesis | code/num2iter.py | Python | mit | 3,819 | 0.005237 |
# Copyright 2007-2016 The HyperSpy developers
#
# This file is part of HyperSpy.
#
# HyperSpy 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 ... | vidartf/hyperspy | hyperspy/tests/signal/test_eds_tem.py | Python | gpl-3.0 | 12,087 | 0 |
# import system modules
import arcpy
from arcpy import env
# Set environment settings
env.workspace = "C:\Users\Ewan\Desktop\SFTPDST5\MapFiles"
try:
# Set the local variable
in_Table = "Trees.csv"
x_coords = "X"
y_coords = "Y"
z_coords = "Z"
out_Layer = "Trees_Layer"
saved_La... | harryfb/DST5 | ArcPy Code/Trees.py | Python | apache-2.0 | 760 | 0.015789 |
import abc
import numpy as np
import tensorflow as tf
from swl.machine_learning.tensorflow_model import SimpleSequentialTensorFlowModel
import swl.machine_learning.util as swl_ml_util
#--------------------------------------------------------------------
class Synth90kCrnn(SimpleSequentialTensorFlowModel):
def __init... | sangwook236/sangwook-library | python/test/language_processing/synth90k_crnn.py | Python | gpl-2.0 | 29,148 | 0.020207 |
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, Gdk
class Clipboard(object):
"""A wrapper around GTK3's clipboard interface. Text only."""
def __init__(self):
self._clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
self.text = None
def __repr__(self):
... | Notgnoshi/clippy | clippy/clipboard.py | Python | mit | 1,004 | 0.001992 |
#
# Copyright (c) 2010 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a copy o... | alikins/subscription-manager | src/subscription_manager/gui/networkConfig.py | Python | gpl-2.0 | 13,296 | 0.002332 |
#!/usr/bin/env python
# -*- coding: iso-8859-1 -*-
""" sha1Hash_test.py
Unit tests for sha1.py
"""
from crypto.hash.sha1Hash import SHA1
import unittest
import struct
assert struct.calcsize('!IIIII') == 20, '5 integers should be 20 bytes'
class SHA1_FIPS180_TestCases(unittest.TestCase):
""" SHA-1... | dknlght/dkodi | src/script.module.cryptopy/lib/crypto/hash/sha1Hash_test.py | Python | gpl-2.0 | 2,199 | 0.012278 |
# 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 u... | sxjscience/tvm | python/tvm/relay/backend/vm.py | Python | apache-2.0 | 9,793 | 0.000715 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
This module will define useful objects for conditional analysis
"""
import collections
import numpy as np
import pandas as pd
from tunacell.base.datatools import Coordinates
# define an object to handle heterogeneous types of time series
class TimeSeries(object):
... | LeBarbouze/tunacell | tunacell/base/timeseries.py | Python | mit | 8,945 | 0.000335 |
import logging
import os
import sys
import time
from typing import TYPE_CHECKING, Optional
from packaging import version
from dvc import __version__
from dvc.utils.pkg import PKG
if TYPE_CHECKING:
from dvc.ui import RichText
logger = logging.getLogger(__name__)
class Updater:
URL = "https://updater.dvc.or... | dmpetrov/dataversioncontrol | dvc/updater.py | Python | apache-2.0 | 5,458 | 0 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
DensifyGeometriesInterval.py by Anita Graser, Dec 2012
based on DensifyGeometries.py
---------------------
Date : October 2012
Copyright : (C) 2012 by Victor Olaya
... | nirvn/QGIS | python/plugins/processing/algs/qgis/DensifyGeometriesInterval.py | Python | gpl-2.0 | 2,659 | 0.000752 |
#coding=utf-8
def generatList(n):
llist=[]
for i in range(n):
t=1
if i%3==1:
t=2*(i/3+1)
llist.append(t)
return llist[::-1]
def generatitem(n):
fz=0
fm=1
llist=generatList(n)
for i in llist:
temp=fm
fm=fz+i*fm
fz=temp
return (fz+2*fm,fm)
fz=[int(x) for x in list(str(generatitem(99)[0]))]
print ... | zhouxiumin/projecteuler | python/euler65.py | Python | apache-2.0 | 329 | 0.097264 |
from dashmat.option_spec.module_imports import module_import_spec
from dashmat.formatter import MergedOptionStringFormatter
from dashmat.core_modules.base import Module
from dashmat.errors import UnknownModule
from input_algorithms.spec_base import boolean, string_spec, formatted, listof, overridden, or_spec, set_opti... | realestate-com-au/dashmat | dashmat/option_spec/import_line.py | Python | mit | 2,434 | 0.015612 |
#!/usr/bin/env python
'''
@file freq_scale.py
@brief Sandbox for various frequency scale generators
@author gm
@copyright gm 2014
This file is part of Chartreuse
Chartreuse 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 Fo... | G4m4/chartreuse | scripts/freq_scale.py | Python | gpl-3.0 | 2,022 | 0.001978 |
# -*- test-case-name: vumi.transports.cellulant.tests.test_cellulant_sms -*-
import json
from urllib import urlencode
from twisted.internet.defer import inlineCallbacks
from vumi.utils import http_request_full
from vumi import log
from vumi.config import ConfigDict, ConfigText
from vumi.transports.httprpc import Htt... | TouK/vumi | vumi/transports/cellulant/cellulant_sms.py | Python | bsd-3-clause | 3,968 | 0.000756 |
##! /usr/bin/env python
# _*_ coding: latin-1 _*_
import jtutil
import jtsocket
import jtdom
def jtexec(cmd):
jtsocket.send("<jtexec>"+jtutil.cdataif(cmd)+"</jtexec>")
# <exitvalue>value</exitvalue>
# vagy
# <execerror>error</execerror>
while 1:
rsp=jtsocket.recv()
if r... | mrev11/ccc3 | jt/jtpython/jtlib/jtexec.py | Python | lgpl-2.1 | 653 | 0.027565 |
#!/usr/bin/env python
# Lucas Walter
# Configure a CameraInfo from a dynamic reconfigure interface
import rospy
from dynamic_reconfigure.server import Server
from sensor_msgs.msg import CameraInfo
from vimjay.cfg import DrCameraInfoConfig
class DrCameraInfo:
def __init__(self):
rospy.init_node('dr_camera... | lucasw/vimjay | scripts/dr_camera_info.py | Python | gpl-3.0 | 1,867 | 0.002142 |
import inspect
import logging
import os
import re
import shlex
import subprocess
import sys
import textwrap
import time
from datetime import datetime
from email.utils import formatdate as format_rfc2822
from io import StringIO
from urllib.parse import quote
import aiohttp
import discord
import psutil
import pytz
from ... | s0hvaperuna/Not-a-bot | cogs/utils.py | Python | mit | 28,689 | 0.002162 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
import time
import gzip
import tempfile
import ConfigParser
from cStringIO import StringIO
from datetime import datetime
from ellen.repo import Jagare
from ellen.utils import JagareError
from vilya.libs.permdir import get_tmpdir
from vilya.mode... | douban/code | vilya/models/ngit/repo.py | Python | bsd-3-clause | 21,073 | 0.000238 |
import os
from osmnames.export_osmnames.export_osmnames import export_housenumbers, create_views
def test_tsv_get_created(session, tables):
session.add(
tables.osm_housenumber(
osm_id=1,
)
)
create_views()
export_housenumbers()
assert os.path.exists('... | philippks/OSMNames | tests/export_osmnames/test_export_housenumbers.py | Python | gpl-2.0 | 365 | 0.00274 |
"""Webhooks for external integrations."""
from __future__ import absolute_import
from django.http import HttpRequest, HttpResponse
from django.utils.translation import ugettext as _
from zerver.models import get_client, UserProfile
from zerver.lib.actions import check_send_message
from zerver.lib.response import json... | sonali0901/zulip | zerver/webhooks/freshdesk/view.py | Python | apache-2.0 | 5,880 | 0.00102 |
import socket
import os
import threading
import time
import zipfile
import threading
import myPacket as mp
def getParentDirectory(path):
path2 = path.split('/')
temp=''
for ph in path2:
if(len(ph)>4 and (ph[len(ph)-4:] == '.txt')):
break
temp = os.path.join(temp, ph)
... | misterlihao/network-programming-project | synchronizationRole.py | Python | mit | 3,395 | 0.010898 |
import warnings
from django.core.exceptions import ImproperlyConfigured
from django.utils import lru_cache, six
from django.utils.deprecation import RemovedInDjango110Warning
from django.utils.functional import cached_property
from django.utils.module_loading import import_string
from .base import Context, Template
f... | jejimenez/django | django/template/engine.py | Python | bsd-3-clause | 10,778 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# ==============================================================================
# MIT License
#
# Copyright (c) 2017-2019 4k1
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "S... | 4k1/wufuzzer | src/util.py | Python | mit | 2,921 | 0.008216 |
#!/usr/bin/env python
# coding: utf-8
import email.utils
import logging
import os
import smtplib
import threading
from email.mime.text import MIMEText
from email.MIMEMultipart import MIMEMultipart
logger = logging.getLogger("maillog")
class MailBase(threading.Thread):
mailServerPort = 25
def __init__(self,... | gannicus-yu/pyutils | myutils/mailbase.py | Python | apache-2.0 | 4,008 | 0.000763 |
from django.apps import AppConfig
class TreeTraversalConfig(AppConfig):
name = 'tree_traversal'
| JacekKarnasiewicz/HomePage | apps/tree_traversal/apps.py | Python | mit | 102 | 0 |
#! /usr/bin/python
# -*- coding: utf-8 -*-
#-----------------------------------------------------------------------------
# Name: setup.py
# Purpose:
# Author: Fabien Marteau <fabien.marteau@armadeus.com>
# Created: 16/02/2009
#-----------------------------------------------------------------------------
# Co... | magyarm/periphondemand-code | setup.py | Python | lgpl-2.1 | 3,545 | 0.010155 |
#!/usr/bin/env python3
import os
import sys
import getopt
import xml.dom.minidom
class CppCreator(object):
def __init__(self, file_name, xml_root, output_path):
if not os.path.exists(output_path):
print ("CppCreator create error")
exit(1)
self.xml_root = xml_r... | face2wind/Elegance | tools/serialize_creator/cpp_creator.py | Python | lgpl-3.0 | 8,346 | 0.003834 |
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 | 0.00266 |
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from collections import OrderedDict
from datetime import date, timedelta
import signals
class UserProfile(models.Model):
user = models.OneToOneField(User, primary_key=True)
# Optional new fields... | badp/weather | weather/models.py | Python | bsd-2-clause | 8,309 | 0.011674 |
from __future__ import absolute_import
from flask import url_for, redirect, abort, request, Blueprint, current_app
from flask_login import login_required, current_user
import six
from six.moves import filter, map
from sqlalchemy.orm.exc import NoResultFound
from itertools import chain
from .. import ships, systems, db... | paxswill/evesrp | src/evesrp/views/api.py | Python | bsd-2-clause | 12,023 | 0.002578 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-09-09 17:28
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('auctions', '0038_offercredit'),
]
operations = [
... | codesy/codesy | auctions/migrations/0039_auto_20160909_1728.py | Python | agpl-3.0 | 573 | 0.001745 |
"""
Implement atoi() in Python (given a string, return a number).
Assume all the strings are always valid.
"""
import unittest
def atoi(string):
l = len(string)
t = 0
v = 10 ** (l - 1)
for ch in string:
t += v * int(ch)
v /= 10
return t
def atoi2(string):
l, t = len(string),... | kratorius/ads | python/interviewquestions/atoi.py | Python | mit | 1,456 | 0.00206 |
#!/usr/bin/env python
# coding: utf-8
import os,sys
import ctypes
import numpy as np
from .hmatrix import _C_HMatrix, HMatrix
class _C_MultiHMatrix(ctypes.Structure):
"""Holder for the raw data from the C++ code."""
pass
class AbstractMultiHMatrix:
"""Common code for the two actual MultiHMatrix classes... | PierreMarchand20/htool | interface/htool/multihmatrix.py | Python | mit | 10,354 | 0.005698 |
# -*- coding: utf-8 -*-
from ast import literal_eval
from odoo import models, fields, api
class SaleOrderLine(models.Model):
_inherit = 'sale.order.line'
config_ok = fields.Boolean(
related='product_id.config_ok',
string="Configurable",
readonly=True
)
@api.multi
def re... | microcom/odoo-product-configurator | product_configurator_wizard/models/sale.py | Python | agpl-3.0 | 1,538 | 0.00065 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import argparse
import numpy as np
import matplotlib
matplotlib.use('Agg')
matplotlib.rcParams['pdf.fonttype'] = 42
matplotlib.rcParams['svg.fonttype'] = 'none'
from deeptools import cm # noqa: F401
import matplotlib.pyplot as plt
from deeptools.correlation im... | fidelram/deepTools | deeptools/plotCorrelation.py | Python | gpl-3.0 | 10,834 | 0.002861 |
# -*- coding: utf-8 -*-
# Copyright 2016 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, fields, api
from openerp.tools.translate import _
from openerp.exceptions import Warning as UserError
class ResPartner(models.Model):
_inherit = "res.partner"... | open-synergy/opnsynid-partner-contact | partner_single_sale_risk_policy/models/res_partner.py | Python | agpl-3.0 | 2,591 | 0 |
#!/usr/bin/python3
# x11vnc
# SoftAP
from sense_hat import SenseHat
from time import sleep
sense = SenseHat()
sense.low_light = True
led_loop = [4, 5, 6, 7, 15, 23, 31, 39, 47, 55, 63, 62, 61, 60, 59, 58, 57, 56, 48, 40, 32, 24, 16, 8, 0, 1, 2, 3]
prev_x = 0
prev_y = 0
while True:
sense.set_rotation(180)
sen... | pindanet/Raspberry | demoSenseHat.py | Python | gpl-3.0 | 2,108 | 0.005693 |
# -*- coding: utf-8 -*-
"""digitalocean API to manage droplets"""
__version__ = "1.16.0"
__author__ = "Lorenzo Setale ( http://who.is.lorenzo.setale.me/? )"
__author_email__ = "lorenzo@setale.me"
__license__ = "LGPL v3"
__copyright__ = "Copyright (c) 2012-2020 Lorenzo Setale"
from .Manager import Manager
from .Drople... | koalalorenzo/python-digitalocean | digitalocean/__init__.py | Python | lgpl-3.0 | 1,128 | 0.001773 |
import zmq
from crpropa import Module
class SendCandidateProperties( Module ):
""" Sends candidate proporties given by the function
```extract_func( candidate )``` over the network
to the server on ```ip_port```
"""
def __init__( self, ip_port, extract_func ):
Module.__init__( self... | adundovi/CRPropa3-scripts | python_modules/network.py | Python | gpl-3.0 | 1,236 | 0.022654 |
#!/usr/bin/env python2
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
'''
Builtin recipes.
'''
import re, time, io
from calibre.web.feeds.news import (BasicNewsRecipe, CustomIndexRecipe,
AutomaticNewsRecipe, CalibrePeriodical)
from calibre.ebooks.BeautifulSoup import Beautif... | timpalpant/calibre | src/calibre/web/feeds/recipes/__init__.py | Python | gpl-3.0 | 1,816 | 0.010463 |
"""Common settings and globals."""
from os.path import abspath, basename, dirname, join, normpath
from sys import path
try:
from secret import *
except:
pass
########## PATH CONFIGURATION
# Absolute filesystem path to the Django project directory:
DJANGO_ROOT = dirname(dirname(abspath(__file__)))
# Absolut... | olarcheveque/usinacv | usinacv/usinacv/settings/base.py | Python | mit | 8,153 | 0.004661 |
import numpy as np
from Coupling import Coupling
class Coupling2DCavities2D(Coupling):
"""
Coupling for cavity2D to cavity transmission.
"""
@property
def impedance_from(self):
"""
Choses the right impedance of subsystem_from.
Applies boundary conditions correction as w... | FRidh/Sea | Sea/model/couplings/Coupling2DCavities2D.py | Python | bsd-3-clause | 1,049 | 0.010486 |
#!/usr/bin/env python
# coding=utf-8
"""157. Solving the diophantine equation <sup>1</sup>/<sub><var>a</var></sub>+<sup>1</sup>/<sub><var>b</var></sub>= <sup><var>p</var></sup>/<sub>10<sup><var>n</var></sup></sub>
https://projecteuler.net/problem=157
Consider the diophantine equation 1/a+1/b= p/10n with a, b, p, n po... | openqt/algorithms | projecteuler/pe157-solving-the-diophantine-equation-sup1supsubvaravarsubsup1supsubvarbvarsub-supvarpvarsupsub10supvarnvarsupsub.py | Python | gpl-3.0 | 823 | 0.009792 |
############################################################################
#
# Copyright (C) 2016 The Qt Company Ltd.
# Contact: https://www.qt.io/licensing/
#
# This file is part of Qt Creator.
#
# Commercial License Usage
# Licensees holding valid commercial Qt licenses may use this file in
# accordance with the co... | pivonroll/Qt_Creator | tests/system/suite_APTW/tst_APTW02/test.py | Python | gpl-3.0 | 1,630 | 0.00184 |
# synthrepo.py - repo synthesis
#
# Copyright 2012 Facebook
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
'''synthesize structurally interesting change history
This extension is useful for creating a repository with properties
... | dscho/hg | contrib/synthrepo.py | Python | gpl-2.0 | 18,180 | 0.000605 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'PrecalculatedValue'
db.create_table('profiles_precalculatedvalue', (
('id', se... | 216software/Profiles | communityprofiles/profiles/oldmigrations/0038_auto__add_precalculatedvalue.py | Python | mit | 15,090 | 0.008217 |
import sales_order_notes
| OpusVL/odoo_line_notes_field | line_notes_field/__init__.py | Python | agpl-3.0 | 25 | 0 |
import logging
import time
import zlib
from collections import defaultdict
from datetime import datetime
from hashlib import sha1
from operator import itemgetter
import simplejson as json
from _mysql_exceptions import IntegrityError
from django.conf import settings
from django.core.cache import cache
from django.core.... | vaishalitekale/treeherder | treeherder/model/derived/jobs.py | Python | mpl-2.0 | 83,969 | 0.000488 |
CSRF_ENABLED = True
SECRET_KEY = 'this-is-a-secret'
| xiaowing/tinysso | config.py | Python | apache-2.0 | 54 | 0 |
from temboo.Library.Yelp.SearchByAddress import SearchByAddress, SearchByAddressInputSet, SearchByAddressResultSet, SearchByAddressChoreographyExecution
from temboo.Library.Yelp.SearchByBoundingBox import SearchByBoundingBox, SearchByBoundingBoxInputSet, SearchByBoundingBoxResultSet, SearchByBoundingBoxChoreographyExec... | jordanemedlock/psychtruths | temboo/core/Library/Yelp/__init__.py | Python | apache-2.0 | 1,354 | 0.005908 |
from sklearn2sql_heroku.tests.classification import generic as class_gen
class_gen.test_model("SGDClassifier" , "FourClass_500" , "mysql")
| antoinecarme/sklearn2sql_heroku | tests/classification/FourClass_500/ws_FourClass_500_SGDClassifier_mysql_code_gen.py | Python | bsd-3-clause | 141 | 0.014184 |
# Copyright (c) LinkedIn Corporation. All rights reserved. Licensed under the BSD-2 Clause license.
# See LICENSE in the project root for license information.
from iris.custom_import import import_custom_module
import logging
logger = logging.getLogger(__name__)
class IrisRoleLookupException(Exception):
pass
d... | dwang159/iris-api | src/iris/role_lookup/__init__.py | Python | bsd-2-clause | 863 | 0.001159 |
#!/usr/bin/env python2
# Copyright (c) 2014-2015 The Bitcoin Core developers
# Copyright (c) 2015-2016 The Bitcoin Unlimited developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_framework import Bit... | SartoNess/BitcoinUnlimited | qa/rpc-tests/abandonconflict.py | Python | mit | 7,686 | 0.008197 |
from bioscrape.inference import DeterministicLikelihood as DLL
from bioscrape.inference import StochasticTrajectoriesLikelihood as STLL
from bioscrape.inference import StochasticTrajectories
from bioscrape.inference import BulkData
import warnings
import numpy as np
class PIDInterface():
'''
PID Interface : Pa... | ananswam/bioscrape | bioscrape/pid_interfaces.py | Python | mit | 13,998 | 0.008573 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-08-03 13:45
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('wins', '0016_win_updated'),
('wins', '0017_auto_20160801_1230'),
]
operations = [
... | UKTradeInvestment/export-wins-data | wins/migrations/0018_merge.py | Python | gpl-3.0 | 324 | 0 |
from .states import (TaskStatus, MultijobActions, TASK_STATUS_PERMITTED_ACTIONS,
TASK_STATUS_STARTUP_ACTIONS)
| GeoMop/GeoMop | src/JobPanel/data/__init__.py | Python | gpl-3.0 | 131 | 0.007634 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Logit'] , ['ConstantTrend'] , ['Seasonal_Hour'] , ['ARX'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_Logit/model_control_one_enabled_Logit_ConstantTrend_Seasonal_Hour_ARX.py | Python | bsd-3-clause | 156 | 0.051282 |
# 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/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/aio/_sql_virtual_machine_management_client.py | Python | mit | 5,342 | 0.003931 |
import os
import sys
import pygame
import signal
import time
import ConfigParser
from twython import TwythonStreamer
#-----------------------------------------------------------------------------
# Import custom modules
#-----------------------------------------------------------------------------
# Add pyscope modul... | ShawnHymel/TweetRace | pytest/wager_test_01.py | Python | mit | 5,938 | 0.011115 |
from __future__ import print_function
import numpy as np
# Chapter 2 Beginning with NumPy fundamentals
#
# Demonstrates the selection
# of ndarray elements.
#
# Run from the commandline with
#
# python elementselection.py
a = np.array([[1,2],[3,4]])
print("In: a")
print(a)
#Out:
#array([[1, 2],
# [3, 4]])
p... | moonbury/notebooks | github/Numpy/Chapter2/elementselection.py | Python | gpl-3.0 | 492 | 0.034553 |
#!/usr/bin/python3
"""
Design and implement a data structure for Least Recently Used (LRU) cache. It
should support the following operations: get and put.
get(key) - Get the value (will always be positive) of the key if the key exists
in the cache, otherwise return -1.
put(key, value) - Set or insert the value if the ... | algorhythms/LeetCode | 146 LRU Cache py3.py | Python | mit | 2,700 | 0 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# 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... | googleapis/python-api-gateway | samples/generated_samples/apigateway_v1_generated_api_gateway_service_create_api_async.py | Python | apache-2.0 | 1,588 | 0.00063 |
from sys import maxsize
class Group:
def __init__(self, name=None, header=None, footer=None, id=None):
self.name = name
self.header = header
self.footer = footer
self.id = id
def __repr__(self):
return "%s:%s:%s:%s" % (self.id, self.name, self.header, self.footer)
... | AklerQ/python_training | model/group.py | Python | apache-2.0 | 674 | 0.002967 |
# -*- coding: utf-8 -*-
u'''\
:mod:`ecoxipy.pyxom` - Pythonic XML Object Model (PyXOM)
========================================================
This module implements the *Pythonic XML Object Model* (PyXOM) for the
representation of XML structures. To conveniently create PyXOM data structures
use :mod:`ecoxipy.pyxom.o... | IvIePhisto/ECoXiPy | ecoxipy/pyxom/__init__.py | Python | mit | 21,834 | 0.001147 |
import bench
from ucollections import namedtuple
T = namedtuple("Tup", ["num", "bar"])
def test(num):
t = T(20000000, 0)
i = 0
while i < t.num:
i += 1
bench.run(test)
| pozetroninc/micropython | tests/internal_bench/var-8-namedtuple-1st.py | Python | mit | 190 | 0.010526 |
"""
WSGI config for school_registry 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.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJAN... | agustin380/school-registry | src/school_registry/wsgi.py | Python | gpl-3.0 | 407 | 0 |
#
# (c) 2016 Red Hat Inc.
#
# This file is part of Ansible
#
# Ansible 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.
#
# Ansible is d... | le9i0nx/ansible | lib/ansible/plugins/action/aireos.py | Python | gpl-3.0 | 3,433 | 0.001748 |
#!/usr/bin/env python3
import argparse
from mygrations.mygrate import mygrate
# argument parsing
parser = argparse.ArgumentParser()
parser.add_argument(
'command',
nargs='?',
default='version',
choices=['version', 'apply', 'check', 'import', 'plan', 'plan_export'],
help='Action to execute (default... | cmancone/mygrations | mygrate.py | Python | mit | 795 | 0.003774 |
###############################################################################
# #
# 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 ... | dparks1134/UniteM | unitem/bin.py | Python | gpl-3.0 | 11,713 | 0.002134 |
#!/usr/bin/env python
"""
Say you have an array for which the ith element is the price of a given stock on day i.
Design an algorithm to find the maximum profit. You may complete at most two transactions.
Note:
You may not engage in multiple transactions at the same time (ie, you must sell the stock before you buy ag... | weixsong/algorithm | leetcode/123.py | Python | mit | 1,949 | 0.00667 |
#!/usr/bin/env python
# Copyright (c) 2017 Trail of Bits, Inc.
#
# 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 applic... | trailofbits/mcsema | tools/mcsema_disass/ida7/disass.py | Python | apache-2.0 | 2,610 | 0.015326 |
import calendar
import datetime
import platform
import time
import os
import ssl
import socket
import urllib
import urlparse
import warnings
import shippo
from shippo import error, http_client, version, util, certificate_blacklist
def _encode_datetime(dttime):
if dttime.tzinfo and dttime.tzinfo.utcoffset(dttime)... | bosswissam/shippo-python | shippo/api_requestor.py | Python | mit | 7,865 | 0.000127 |
from flask import Blueprint, flash, redirect, render_template, request, url_for,send_from_directory, abort, make_response, send_file, session
from octs.user.models import Course,Task, User, Message, Team,TeamUserRelation, File,Source,Term,TaskTeamRelation, Tag,UserScore
from .forms import CourseForm,TaskForm, FileForm,... | kaiueo/octs | octs/teacher/views.py | Python | bsd-3-clause | 34,607 | 0.014882 |
from django.conf.urls import patterns, include, url
from django.conf import settings
urlpatterns = patterns('',
url(r'^media/(?P<path>.*)$', 'django.views.static.serve', \
{'document_root': settings.MEDIA_ROOT, 'show_indexes':True}),
url(r'', include('controller.urls')),
url('^.*/$', 'controller.v... | oskgeek/xmccamp | xmccamp/xmccamp/urls.py | Python | mit | 338 | 0.011834 |
#! /usr/bin/python
import re
input = raw_input()
result = re.findall(r"[0-9]",input)
print(result)
| JesusAMR/ProgramasUNI | testing.py | Python | gpl-3.0 | 101 | 0.009901 |
#
# Copyright 2018 Red Hat | Ansible
#
# This file is part of Ansible
#
# Ansible 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.
#
# ... | KohlsTechnology/ansible | lib/ansible/module_utils/k8s/lookup.py | Python | gpl-3.0 | 7,677 | 0.001693 |
from marshmallow import Schema, fields, post_load
from floyd.model.base import BaseModel
class ExperimentConfigSchema(Schema):
name = fields.Str()
family_id = fields.Str()
@post_load
def make_access_token(self, data):
return ExperimentConfig(**data)
class ExperimentConfig(BaseModel):
... | mckayward/floyd-cli | floyd/model/experiment_config.py | Python | apache-2.0 | 507 | 0 |
'''
Created on Dec 21, 2013
@author: Chris
'''
import sys
import hashlib
from time import time as _time
from time import sleep as _sleep
from argparse import ArgumentParser
from gooey import Gooey
@Gooey
def main():
desc = "Mock application to test Gooey's functionality"
file_help_msg = "Name o... | garrettcap/Bulletproof-Backup | gooey/mockapplications/mockapp.py | Python | gpl-2.0 | 2,121 | 0.016973 |
#!/usr/bin/env python
#
# Copyright 2009, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... | sfiera/googletest | test/gtest_help_test.py | Python | bsd-3-clause | 5,754 | 0.003823 |
urlpatterns = []
handler404 = 'csrf_tests.views.csrf_token_error_handler'
| nesdis/djongo | tests/django_tests/tests/v22/tests/csrf_tests/csrf_token_error_handler_urls.py | Python | agpl-3.0 | 75 | 0 |
# -*- coding: utf-8 -*-
#
# Optcoretech documentation build configuration file, created by
# sphinx-quickstart on Mon Sep 1 14:23:01 2014.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
#... | nishantsingla/optcoretech | docs/conf.py | Python | mit | 7,786 | 0.007449 |
import sys
from csv_data import Data
from csv_utilities import readIntegerCSV
from csv_utilities import convertToZeroOne
from statistics import mean
from math import log
def dotProduct( arr1, arr2 ):
return sum( [ arr1[idx] * arr2[idx] for idx in range( len( arr1 ) ) ] )
#
def dataSubsetWithY( data, y ):
return [ r... | CKPalk/MachineLearning | Assignment3/Naive_Bayes/nb.py | Python | mit | 2,586 | 0.095514 |
import os
from PodSix.Resource import *
from PodSix.Concurrent import Concurrent
class Progress(Concurrent):
def __init__(self):
Concurrent.__init__(self)
self.sprite = Image(file=os.path.join("resources", "progress.png"))
self.showing = False
self.maximum = 1
self.value = 0
self.width = 142
self.heig... | chr15m/Infinite8BitPlatformer | engine/Progress.py | Python | gpl-3.0 | 960 | 0.039583 |
# Copyright (c) 2014 Lasercar7 (@lasercar) - MIT License
# http://lasercar.github.io
#TODO: dictionary that maps block ids (to be collected) with readable names
stats = {}
def logStat(block, elevation):
if not block in stats:
#initialize column
stats[block] = map(lambda x: 0.0, range(256))
#add to stat
stats[b... | lasercar/mcedit-filters | block_elevation_stats.py | Python | mit | 1,764 | 0.036281 |
import re
from collections import namedtuple
import sqlparse
from django.db.backends.base.introspection import (
BaseDatabaseIntrospection, FieldInfo as BaseFieldInfo, TableInfo,
)
from django.db.models import Index
from django.utils.regex_helper import _lazy_re_compile
FieldInfo = namedtuple('FieldInfo', BaseFi... | kaedroho/django | django/db/backends/sqlite3/introspection.py | Python | bsd-3-clause | 18,452 | 0.001734 |
import json
import logging
import boto3
import unittest2
from mock import MagicMock
from monocyte.handler import iam as iam_handler
class IamInlinePolicyTests(unittest2.TestCase):
def setUp(self):
self.arn = ''
logging.captureWarnings(True)
self.iam_handler = iam_handler.InlinePolicy(Magi... | ImmobilienScout24/aws-monocyte | src/integrationtest/python/handler/iam_inline_policy_tests.py | Python | apache-2.0 | 4,364 | 0.000458 |
from pytest import mark
from django.urls import reverse
from email_template.models import Email
from assopy.models import AssopyUser
from conference.accounts import PRIVACY_POLICY_CHECKBOX, PRIVACY_POLICY_ERROR
from conference.models import CaptchaQuestion
from conference.users import RANDOM_USERNAME_LENGTH
from te... | EuroPython/epcon | tests/test_user_login_and_registration.py | Python | bsd-2-clause | 8,704 | 0.00023 |
# Copyright (C) 2011 Canonical
#
# Authors:
# Matthew McGowan
# Michael Vogt
#
# 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; version 3.
#
# This program is distributed in the hope that it wi... | armikhael/software-center | softwarecenter/db/enquire.py | Python | gpl-3.0 | 13,223 | 0.002723 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
This script creates new items on Wikidata based on certain criteria.
* When was the (Wikipedia) page created?
* When was the last edit on the page?
* Does the page contain interwiki's?
This script understands various command-line arguments:
-lastedit The minimum ... | xZise/pywikibot-core | scripts/newitem.py | Python | mit | 4,866 | 0.000822 |
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
import json
import pymongo
from scrapy.settings import Settings
from scrapy.exceptions import DropItem
from scrapy import log
fr... | diegordzr/YellowSpider | yellow/yellow/pipelines.py | Python | mit | 1,714 | 0.021004 |
student_phoneNumber_name = {1: 'a', 3: 'c', 2: 'b'}
def Handler() :
while (1) :
choice = eval(input("Enter :\t 1 - to search student name \n \t 2 - to insert new student record \n \t 0 - to quit\n"))
print(choice)
if (choice == 1) :
if (student_phoneNumber_name) :
phone_number = input("Enter student's p... | ajitghz582/PythonLearning | DAY_1_ASSIGNMENTS/1_name_phone_number.py | Python | mit | 1,070 | 0.052336 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.