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 |
|---|---|---|---|---|---|---|
## Close
### What is the value of the first triangle number to have over five hundred divisors?
print max([len(m) for m in map(lambda k: [n for n in range(1,(k+1)) if k%n == 0], [sum(range(n)) for n in range(1,1000)])]) | jacksarick/My-Code | Python/python challenges/euler/012_divisable_tri_nums.py | Python | mit | 219 | 0.03653 |
# Copyright (c) 2012 Rackspace Hosting
# 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 req... | akash1808/nova_test_latest | nova/tests/unit/compute/test_compute_cells.py | Python | apache-2.0 | 18,463 | 0.0013 |
"""
Support for KNX/IP climate devices.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/climate.knx/
"""
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components.climate import (
PLATFORM_SCHEMA, SUP... | PetePriority/home-assistant | homeassistant/components/knx/climate.py | Python | apache-2.0 | 11,010 | 0 |
"""Entity class that represents Z-Wave node."""
# pylint: disable=import-outside-toplevel
from itertools import count
from homeassistant.const import ATTR_BATTERY_LEVEL, ATTR_ENTITY_ID, ATTR_WAKEUP
from homeassistant.core import callback
from homeassistant.helpers.device_registry import async_get_registry as get_dev_r... | tboyce021/home-assistant | homeassistant/components/zwave/node_entity.py | Python | apache-2.0 | 12,522 | 0.000878 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | MarcosCommunity/odoo | addons/purchase/purchase.py | Python | agpl-3.0 | 93,906 | 0.0064 |
from prompt_toolkit import Application
from prompt_toolkit.interface import CommandLineInterface
from prompt_toolkit.shortcuts import create_eventloop
from prompt_toolkit.key_binding.manager import KeyBindingManager
from prompt_toolkit.keys import Keys
from prompt_toolkit.buffer import Buffer, AcceptAction
from prompt_... | anhlt/twitter_cli | twitter_cli/main.py | Python | mit | 3,569 | 0.00028 |
"""Defines a sync module for Blink."""
import logging
from requests.structures import CaseInsensitiveDict
from blinkpy import api
from blinkpy.camera import BlinkCamera, BlinkCameraMini, BlinkDoorbell
from blinkpy.helpers.util import time_to_seconds
from blinkpy.helpers.constants import ONLINE
_LOGGER = logging.getL... | fronzbot/blinkpy | blinkpy/sync_module.py | Python | mit | 12,603 | 0.000714 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @author: Elivis.Zhang <elivis.zhang@aliyun.com>
# QQ Group:99798703
# Created on Aug 8, 2015
# -*- coding: utf-8 -*-
import MySQLdb
import settings
class db_operate:
def mysql_command(self,conn,sql_cmd):
try:
ret = []
conn=MySQLdb.con... | Elivis/opsa-master | opsa/mysql.py | Python | gpl-2.0 | 1,197 | 0.020084 |
# ####################################################################
# gofed - set of tools to automize packaging of golang devel codes
# Copyright (C) 2014 Jan Chaloupka, jchaloup@redhat.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public Licen... | piotr1212/gofed | ggi.py | Python | gpl-2.0 | 8,925 | 0.032381 |
# Copyright 2014, Doug Wiegley, A10 Networks.
#
# 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 appli... | mdurrant-b3/acos-client | acos_client/tests/unit/v30/test_slb_virtual_port.py | Python | apache-2.0 | 22,343 | 0.001074 |
"""
Provides classes that represent complete taxonomies, built using components from
the taxacomponents module.
"""
from taxacomponents import Citation, RankTable, Taxon
from taxonvisitor import TaxonVisitor
from taxonvisitors_concrete import PrintTaxonVisitor, CSVTaxonVisitor
from nameresolve import CoLNamesResolver... | stuckyb/sqlite_taxonomy | utilities/taxolib/taxonomy.py | Python | gpl-3.0 | 15,593 | 0.005066 |
from gwpy.plot import Plot
plot = Plot(noise, signal, data, separate=True, sharex=True, sharey=True)
plot.gca().set_epoch(0)
plot.show() | gwpy/gwpy.github.io | docs/latest/examples/timeseries/inject-5.py | Python | gpl-3.0 | 136 | 0.007353 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author Pradeep Jairamani; github.com/pradeepjairamani
import socket
import socks
import time
import json
import threading
import string
import requests
import random
import os
from core.alert import *
from core.targets import target_type
from core.targets import target_t... | Nettacker/Nettacker | lib/scan/wp_timthumbs/engine.py | Python | gpl-3.0 | 10,981 | 0.003461 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
import_csv.py
~~~~~~~~~~~~~~~~~~~~
Import csv file into database.
The CSV file should be in this format:
Datetime;price;quantity;mileage
2013/10/03 07:00:00;34.01;25.90;149340
:copyright: (c) 2014 by Patrick Rabu.
:license: ... | patrabu/carbu | import_csv.py | Python | gpl-3.0 | 1,167 | 0.007712 |
'Automated Valuation Model'
import pdb
import numpy as np
import pandas as pd
from pprint import pprint
import sklearn
import sklearn.ensemble
import sklearn.linear_model
import sklearn.preprocessing
from columns_contain import columns_contain
import AVM_elastic_net
import AVM_gradient_boosting_regressor
import AVM_... | rlowrance/re-avm | AVM.py | Python | bsd-3-clause | 3,934 | 0.001525 |
#!/usr/bin/env python
import ldapdomaindump
ldapdomaindump.main()
| dirkjanm/ldapdomaindump | ldapdomaindump/__main__.py | Python | mit | 66 | 0 |
#!/usr/bin/python3
import os
import os.path
import cgi, cgitb
import re
import pickle
#own packages
import dbcPattern
def dbc_main(): # NEW except for the call to processInput
form = cgi.FieldStorage() # standard cgi script lines to here!
# use format of next two lines with YOUR names and default data... | mauerflitza/Probieren2 | Webpage/cgi-bin/upload.py | Python | mit | 1,801 | 0.048333 |
# Colors
DARKBGCOLOR = tuple([93, 93, 93])
MEDBGCOLOR = tuple([73, 73, 73])
MAYABGCOLOR = tuple([68, 68, 68])
# DPI
DEFAULT_DPI = 96
# Pixel Size is not handled by dpi, use utils.dpiScale()
MARGINS = (2, 2, 2, 2) # default margins left, top, right, bottom
SPACING = 2
SSML = 4 # the regular spacing of each widget, ... | dsparrow27/zoocore | zoo/libs/pyqt/uiconstants.py | Python | gpl-3.0 | 1,709 | 0.005266 |
###############################
# old_password_generator.py #
###############################
import string, random, sys
SELECT = string.ascii_letters + string.punctuation + string.digits
SAMPLE = random.SystemRandom().sample
def main():
while True:
size = get_size()
password = generate_pw(size... | ActiveState/code | recipes/Python/578171_Just_Another_Password_Generator/recipe-578171.py | Python | mit | 2,824 | 0.004958 |
import optparse
import os
import shutil
import sys
import unittest
from itertools import izip
from . import util
from . import stats
#=============================================================================
# common utility functions for testing
def clean_dir(path):
if os.path.exists(path):
shutil... | wutron/compbio | rasmus/testing.py | Python | mit | 3,789 | 0.000792 |
import json
import os
from AppKit import NSApplication, NSStatusBar, NSMenu, NSMenuItem, NSVariableStatusItemLength, NSImage
from PyObjCTools import AppHelper
from project_cron.models import Schedule
from threading import Timer
from project_cron.utils import logutil
class App(NSApplication):
def finishLaunching(... | ecleya/project_cron | main.py | Python | mit | 2,772 | 0.002165 |
import sys
current_word = None
current_count = 0
word = None
for line in sys.stdin:
line = line.strip()
word,count = line.split('\t',1)
try:
count = int(count)
except ValueError:
continue
if current_word == word:
current_count +=... | MihawkHu/CS433_ParallerProgramming_Project | Project4/wordcount/python_wordcount/reducer.py | Python | mit | 574 | 0.057491 |
import uuid
import arrow
from collections import namedtuple
HEADERS = ('start', 'stop', 'project', 'id', 'tags', 'updated_at')
class Frame(namedtuple('Frame', HEADERS)):
def __new__(cls, start, stop, project, id, tags=None, updated_at=None,):
try:
if not isinstance(start, arrow.Arrow):
... | yloiseau/Watson | watson/frames.py | Python | mit | 4,355 | 0 |
# Copyright 2013-2017 DataStax, 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 applicable law or agreed to in writi... | coldeasy/python-driver | tests/integration/cqlengine/test_batch_query.py | Python | apache-2.0 | 8,003 | 0.002249 |
A = [[0, 1, 0, 0, 0, 0],
[0, 0, 1, 0, 0, 0],
[0, 0, 0, 0, 1, 0],
[0, 0, 1, 0, 1, 0],
[1, 0, 0, 0, 0, 0],
[0, 1, 0, 0, 0, 0]]
def Distancias(n, origem):
d = [-1] * n
d[origem] = 0
f = []
f.append(origem)
while len(f) > 0:
x = f[0]
del f[0]
for y in range(n):
if A[x]... | andersonsilvade/python_C | Python32/ED/Distâncias em uma Rede.py | Python | mit | 444 | 0.027027 |
# coding=utf-8
# Copyright 2018 The Tensor2Tensor Authors.
#
# 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... | mlperf/training_results_v0.5 | v0.5.0/google/research_v3.32/gnmt-tpuv3-32/code/gnmt/model/t2t/tensor2tensor/layers/common_layers.py | Python | apache-2.0 | 132,971 | 0.007994 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wagtailcore', '0022_add_site_name'),
]
operations = [
migr... | chrxr/wagtail | wagtail/wagtailcore/migrations/0023_alter_page_revision_on_delete_behaviour.py | Python | bsd-3-clause | 622 | 0.001608 |
# -*- mode:python -*-
import flask
import json
import logging
from datetime import datetime
import inflection
from functools import wraps
from flask import request, url_for
from werkzeug.exceptions import HTTPException
from .client.api.model import *
from . import database
from . import helpers
from .application imp... | aalpern/tessera | tessera-server/tessera/views_api.py | Python | apache-2.0 | 10,412 | 0.004898 |
# -*- coding: utf-8 -*-
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't pickleable (module imports are okay, they're removed automatically).
#
# All configuration values have a default value;... | bugsduggan/locust | docs/conf.py | Python | mit | 2,962 | 0.005739 |
import os
from typing import Dict, List, Union
OptionalJSON = Union[List, Dict, float, int, str, bool, None]
def ensure_dir_exists(directory):
if not os.path.exists(directory):
os.mkdir(directory)
def get_dir(directory: str) -> str:
"""
Return a string which contains the complete path to the in... | physicalattraction/PATinderBot | src/common.py | Python | gpl-3.0 | 821 | 0 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
# arranged print
from pprint import pprint, pformat
# Jinja2 Template Engine
from jinja2 import Template, Environment
# JSNAPy
from jnpr.junos import Device
from jnpr.junos.utils.config import Config
from jnpr.jsnapy import SnapAdmin
template_dir_name = './... | taijiji/sample_jsnapy | run_test_bgp_advertised_route.py | Python | mit | 2,089 | 0.011967 |
import sys
import numpy as np
if __name__ == '__main__':
print 'Loading word vectors...'
wordvecs = None
wordlist = []
for i, line in enumerate(sys.stdin):
word, vec = line.strip().split(' ', 1)
vec = map(float, vec.split())
if wordvecs is None:
wordvecs = np.ones((400000, len(vec)), dtype=n... | Smerity/glove-guante | cosine_similarity.py | Python | mit | 1,457 | 0.008922 |
"""
Given a nested list of integers represented as a string, implement a parser to deserialize it.
Each element is either an integer, or a list -- whose elements may also be integers or other lists.
Note: You may assume that the string is well-formed:
String is non-empty.
String does not contain white spaces.
String... | dichen001/Go4Jobs | JackChen/string/385. Mini Parser.py | Python | gpl-3.0 | 2,721 | 0.00294 |
"""
Optimal power flow based on branch power flow modelling
Additional case33 is added to the test cases
Note: The proposed method has been verified
@author: Tianyang Zhao
@email: zhaoty@ntu.edu.sg
"""
from Two_stage_stochastic_optimization.power_flow_modelling import case33
from pypower import runopf
from gurobip... | Matrixeigs/Optimization | Two_stage_stochastic_optimization/optimal_power_flows/opf_branch_power.py | Python | mit | 4,744 | 0.005691 |
# coding: utf-8
import json
import os
import time
from graphite_api._vendor import whisper
from . import TestCase, WHISPER_DIR
try:
from flask.ext.cache import Cache
except ImportError:
Cache = None
class RenderTest(TestCase):
db = os.path.join(WHISPER_DIR, 'test.wsp')
url = '/render'
def crea... | winguru/graphite-api | tests/test_render.py | Python | apache-2.0 | 24,960 | 0.00004 |
from common.persistence import from_pickle
NWORDS = from_pickle('../data/en_dict.pkl')
print(len(NWORDS))
print(NWORDS['word'])
print(NWORDS['spell'])
alphabet = 'abcdefghijklmnopqrstuvwxyz'
def edits1(word):
s = [(word[:i], word[i:]) for i in range(len(word) + 1)]
deletes = [a + b[1:] for a, b in s if b]
... | anderscui/spellchecker | simple_checker/checker_tests_google_dict.py | Python | mit | 17,844 | 0.00863 |
#
# humanagent.py - provides server-side backend for interaction with
# human players in team formation
#
# Copyright (C) 2015 Nathan Dykhuis
#
# 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 Softw... | NDykhuis/team-formation-study-software | humanagent.py | Python | gpl-2.0 | 25,571 | 0.013922 |
"""
A list is a sequence
1.Can be any type
2.The values in a list are called elements or sometimes items
3.Declare with square brackets: [ ]
4.Can be nested. [x, y, [z1, z2]]
"""
myStr1 = 'aabbcc'
myStr2 = 'aabbcc'
print('myStr1 = ', myStr1)
print('myStr2 = ', myStr2)
print('myStr1 is myStr2 = ', myStr1 is myStr2,... | flake123p/ProjectH | Python/_Basics_/A11_Reference/test.py | Python | gpl-3.0 | 817 | 0.007344 |
#!/usr/bin/python
#coding: UTF-8
#COPIRIGHT: Patrick Roncagliolo
#LICENCE: GNU GPL 3
import cgi, json
argsDict = cgi.FieldStorage()
EMPTY_DICT = {}
def getState (init = False):
dataDict = getDataDict ()
if dataDict is None \
and init is True:
(key, uri) = generateTOTP ()
generateQR (k... | roncapat/RWOL | rwol-web-src/utilities.py | Python | gpl-3.0 | 3,772 | 0.012725 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2016-2017 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... | NoctuaNivalis/qutebrowser | tests/unit/browser/test_tab.py | Python | gpl-3.0 | 3,502 | 0 |
"""
WSGI config for dj_bookmarks 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.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO... | kennethlove/django_bookmarks | dj_bookmarks/dj_bookmarks/wsgi.py | Python | bsd-3-clause | 402 | 0 |
'''
MAVLink protocol implementation (auto-generated by mavgen.py)
Generated from: test.xml
Note: this file has been auto-generated. DO NOT EDIT
'''
import struct, array, time, json, os, sys, platform
from ...generator.mavcrc import x25crc
import hashlib
WIRE_PROTOCOL_VERSION = '2.0'
DIALECT = 'test'
PROTOCOL_MARK... | fqez/JdeRobot | src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v20/test.py | Python | gpl-3.0 | 31,243 | 0.004161 |
############################################################################
# Generic script applicable on any Operating Environments (Unix, Windows)
# ScriptName : wls_reset.py
# Properties : weblogic.properties
# Author : Kevin Yuan
#############################################################... | bfg-repo-cleaner-demos/eclipselink.runtime-bfg-strip-big-blobs | jpa/eclipselink.jpa.test/resource/weblogic/wls_composite_reset.py | Python | epl-1.0 | 998 | 0.018036 |
from capstone import *
from .architecture import Architecture
from avatar2.installer.config import GDB_X86, OPENOCD
class X86(Architecture):
get_gdb_executable = Architecture.resolve(GDB_X86)
get_oocd_executable = Architecture.resolve(OPENOCD)
qemu_name = 'i386'
gdb_name = 'i386'
registers =... | avatartwo/avatar2 | avatar2/archs/x86.py | Python | apache-2.0 | 6,401 | 0.010155 |
# -*- coding: utf-8 -*-
# Copyright(C) 2010-2011 Romain Bignon
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at you... | Boussadia/weboob | modules/dlfp/browser.py | Python | agpl-3.0 | 9,155 | 0.005789 |
# -*- coding: utf-8 -*-
# This file is part of Shoop.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
import os
from django.core.exceptions import ImproperlyConfigured
from sho... | akx/shoop | shoop_workbench/settings/__init__.py | Python | agpl-3.0 | 1,393 | 0.000718 |
from LazyMail import LazyMail, encode_string
import email
import datetime
import os
import cgi
import re
import logging
from email.header import decode_header
__author__ = 'doms'
class SavableLazyMail(LazyMail):
def __init__(self, config, mail_connection, uid, stats):
self.STATS = stats
self.CONF... | dserv01/BackupMailToHTML | SavableLazyMail.py | Python | gpl-3.0 | 10,434 | 0.007188 |
from __future__ import print_function
import numpy as np
import sys
import bisect
import datetime
import gzip
def my_print(s):
print("[" + str(datetime.datetime.now()) + "] " + s, file=sys.stderr)
if len(sys.argv) < 3:
print("Usage: process_mz_query.py dump_file[.gz] query_file")
exit(0)
my_print("Readi... | alexandrovteam/pyImagingMSpec | pyImagingMSpec/scripts/process_mz_query.py | Python | apache-2.0 | 1,468 | 0.017711 |
#
# Copyright 2019 The FATE 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 appli... | FederatedAI/FATE | python/federatedml/feature/binning/quantile_tool.py | Python | apache-2.0 | 3,447 | 0.001451 |
# -*- coding: utf-8 -*-
# Author: Joris Jensen <jjensen@techfak.uni-bielefeld.de>
#
# License: BSD 3 clause
from __future__ import division
import math
from math import log
import numpy as np
from scipy.optimize import minimize
from .glvq import GlvqModel
from sklearn.utils import validation
class GmlvqModel(Glv... | MrNuggelz/sklearn-glvq | sklearn_lvq/gmlvq.py | Python | bsd-3-clause | 12,014 | 0.000083 |
""":mod:`libearth.sanitizer` --- Sanitize HTML tags
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
import cgi
try:
import htmlentitydefs
import HTMLParser
except ImportError:
from html import entities as htmlentitydefs, parser as HTMLParser
import re
try:
import urlparse
except ImportError:
... | earthreader/libearth | libearth/sanitizer.py | Python | gpl-2.0 | 5,176 | 0.000193 |
import couchdb
import matplotlib.pyplot as plt
from matplotlib.path import Path
import matplotlib.patches as patches
import json
import matplotlib.path as mplPath
import numpy as np
import requests
from textblob import TextBlob
import Queue
import time, socket, threading
import re
from pycorenlp import StanfordCoreNLP
... | COMP90024CloudComputing/Submit_Cloud_Computing | analysis.py | Python | apache-2.0 | 8,425 | 0.01543 |
# encoding: UTF-8
'''
1. 合约选择
Contracts_init.json中写入需要订阅的期货品种,如需要订阅pp和IF,写入
{
"pp": "0",
"IF": "0"
}
2. 主力合约判断
运行程序后,点击‘合约初始化’按钮,程序会获取通联的期货数据,自动判断主力合约。并写入Contracts_init.json中。
注:通联选择的是持仓量判断主力,本程序选择的是昨日成交量判断,两者不同时会给出提示。
3. 合约订阅
4. Tick存储
'''
import json
import os
import pymongo
import tushare as ts
# ts.set_tok... | freeitaly/Trading-System | vn.trader/dataRecorderAlone/DataRecorder -Paolo版本/uiDataRecorder1.py | Python | mit | 13,588 | 0.003854 |
import _plotly_utils.basevalidators
class ArrayminussrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self, plotly_name="arrayminussrc", parent_name="bar.error_x", **kwargs
):
super(ArrayminussrcValidator, self).__init__(
plotly_name=plotly_name,
pa... | plotly/plotly.py | packages/python/plotly/plotly/validators/bar/error_x/_arrayminussrc.py | Python | mit | 429 | 0 |
from optparse import make_option
from optparse import OptionParser
import logging
#import os
#import sys
import contextlib
#import hashlib
import datetime
from django.core.management.base import BaseCommand
from django.conf import settings
#from django.db.models import Q
import dateutil
import netCDF4
from lizard_ne... | lizardsystem/lizard-neerslagradar | lizard_neerslagradar/management/commands/create_geotiffs.py | Python | gpl-3.0 | 2,139 | 0.002338 |
from pythonforandroid.toolchain import shprint, current_directory
from pythonforandroid.recipe import Recipe
from multiprocessing import cpu_count
from os.path import exists
import sh
class LibSecp256k1Recipe(Recipe):
url = 'https://github.com/bitcoin-core/secp256k1/archive/master.zip'
def build_arch(self, ... | wexi/python-for-android | pythonforandroid/recipes/libsecp256k1/__init__.py | Python | mit | 1,139 | 0 |
import numpy as np
import scipy.interpolate as interp
import warnings
from astropy.io import fits
def concentration(radii, phot, eta_radius=0.2, eta_radius_factor=1.5, interp_kind='linear', add_zero=False):
"""
Calculates the concentration parameter
C = 5 * log10(r_80 / r2_0)
Inputs:
radii -- 1d a... | astronomeralex/morphology-software | morphology.py | Python | mit | 3,255 | 0.009831 |
#!/usr/bin/env python
#
# Copyright 2009 The Closure Library 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
... | SOCR/HTML5_WebSite | HTML5/BrainPainter/X/lib/closure-library/closure/bin/build/depswriter.py | Python | lgpl-3.0 | 6,203 | 0.009028 |
"""Implements basics of Capa, including class CapaModule."""
import cgi
import copy
import datetime
import hashlib
import json
import logging
import os
import traceback
import struct
import sys
import re
# We don't want to force a dependency on datadog, so make the import conditional
try:
import dogstats_wrapper a... | chrisndodge/edx-platform | common/lib/xmodule/xmodule/capa_base.py | Python | agpl-3.0 | 62,222 | 0.002588 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2011 Nick Hall
# Copyright (C) 2011 Gary Burton
#
# 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
#... | gramps-project/gramps | gramps/gui/widgets/grampletbar.py | Python | gpl-2.0 | 28,336 | 0.002188 |
#!/usr/bin/env python
import re
from ciscoconfparse import CiscoConfParse
def main():
'''
using the ciscoconfparse to find the crypto maps that are not using AES
'''
cisco_file = 'cisco_ipsec.txt'
cisco_cfg = CiscoConfParse(cisco_file)
crypto_maps = cisco_cfg.find_objects_wo_child(parentspec... | hbenaouich/Learning-Python | class-1/ex10_confParse.py | Python | apache-2.0 | 760 | 0.009211 |
# -*- coding: utf-8 -*-
"""
flaskbb.management.models
~~~~~~~~~~~~~~~~~~~~~~~~~
This module contains all management related models.
:copyright: (c) 2014 by the FlaskBB Team.
:license: BSD, see LICENSE for more details.
"""
from wtforms import (TextField, IntegerField, FloatField, BooleanField,
... | nathanhilbert/FPA_Core | openspending/forum/management/models.py | Python | agpl-3.0 | 8,135 | 0 |
# -*- coding: utf-8 -*-
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ludacity.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| branchard/ludacity | manage.py | Python | gpl-2.0 | 253 | 0 |
# -*- encoding: utf-8 -*-
# https://github.com/justintv/Twitch-API/blob/master/v3_resources/blocks.md
from twitch.queries import query
# Needs Authentification
@query
def by_name(user):
raise NotImplementedError
# Needs Authentification, needs PUT
@query
def add_block(user, target):
raise NotImplementedErr... | ingwinlu/python-twitch | twitch/api/v3/blocks.py | Python | gpl-3.0 | 430 | 0 |
class Solution(object):
def isScramble(self, s1, s2):
"""
:type s1: str
:type s2: str
:rtype: bool
"""
if s1 == s2:
return True
if len(s1) != len(s2):
return False
from collections import Counter
if Counter(s1) != Counte... | daicang/Leetcode-solutions | 087-scramble-string.py | Python | mit | 759 | 0.00527 |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2019 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.org/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, eith... | dontnod/weblate | weblate/wladmin/models.py | Python | gpl-3.0 | 6,438 | 0.000777 |
#!/usr/bin/python
#
# motorsClass.py MOTORS CLASS
#
# METHODS:
# motors(readingPerSec) # create instance and motor control thread
# cancel() # stop motors, close motor control thread
# drive(driveSpeed) # ramp speed to go fwd(+) or back(... | slowrunner/RWPi | posie/posie-web/rwpilib/motorsClass.py | Python | gpl-3.0 | 27,889 | 0.033992 |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | KaranToor/MA450 | google-cloud-sdk/lib/surface/compute/health_checks/create/http.py | Python | apache-2.0 | 3,471 | 0.004033 |
#!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
plt.style.use('grandbudapest')
# Fixing random state for reproducibility
np.random.seed(1)
fig, axes = plt.subplots(ncols=2, nrows=2)
ax1, ax2, ax3, ax4 = axes.ravel()
# scatter plot (Note: `plt.scatter` doesn't use default colors)
x, y = np.r... | cako/mpl_grandbudapest | grandbudapest.py | Python | mit | 1,318 | 0 |
# -*- coding: utf-8 -*-
##########################################################################
# #
# Eddy: a graphical editor for the specification of Graphol ontologies #
# Copyright (C) 2015 Daniele Pantaleone <danielepantaleone@me.com> ... | ashwingoldfish/eddy | eddy/core/commands/nodes.py | Python | gpl-3.0 | 14,989 | 0.000267 |
#!/usr/bin/env python
import os
import os.path
import sys
import string
###############################################################
## #
## Edyta Malolepsza #
## David Wales' group, University of Cambridge ... | marktoakley/LamarckiAnt | SCRIPTS/AMBER/symmetrise_prmtop/perm-prmtop.ff02.py | Python | gpl-3.0 | 25,578 | 0.020916 |
# Copyright (c) 2012 Lars Hupfeldt Nielsen, Hupfeldt IT
# All rights reserved. This work is under a BSD license, see LICENSE.TXT.
def int_to_bin_str(value, max_bits=8192):
"""Convert an int to a string representation of a bitmask (binary number)"""
mask = value
bits = 1
while 1 << bits < value or bi... | lhupfeldt/multiconf | multiconf/bits.py | Python | bsd-3-clause | 515 | 0.001942 |
#
__author__ = 'Michael Pfister'
__version__ = '1.4.0'
| pfitzer/youtube2mp3 | youtube2mp3/__init__.py | Python | gpl-2.0 | 55 | 0 |
from modules.chart_module import ChartModule
import tornado.web
import logging
class LineChartModule(ChartModule):
def render(self, raw_data, keys, chart_id="linechart"):
self.chart_id = chart_id
self.chart_data = self.overtime_linechart_data(raw_data, keys)
return self.render_string('mod... | SFII/cufcq-new | modules/linechart_module.py | Python | mit | 5,898 | 0.000848 |
def firstCharacter(str):
return str[:1]
assert(firstCharacter("abc") is "a")
def lastCharacter(str):
return str[-1:]
assert(lastCharacter("abc") is "c")
def middleCharacters(str):
return str[1:-1]
assert(middleCharacters("abc") == "b")
assert(middleCharacters("abcde") == "bcd")
def isPalindrome(str... | iandmyhand/python-utils | DataStructuresAndAlgorithmsInPython/Palindrome.py | Python | mit | 595 | 0.011765 |
if __name__ == '__main__':
import os
from bs4 import BeautifulSoup
def get_class(cls):
class_name = cls['name']
_instance_methods = cls.find_all('method', recursive=False, class_method=lambda m: m != 'true')
retval = cls.find('retval')
if retval:
if retval.has_a... | colinta/MotionLookitup | compile.py | Python | bsd-2-clause | 4,942 | 0.006273 |
import os
import sys
import shutil
from glob import glob
# --------------------------------------------------------------------------
DOC_DIR = 'hr-html'
PYWRAPS_FN = 'idaapi.py'
# --------------------------------------------------------------------------
def add_footer(lines):
S1 = 'Generated by Epydoc'
S2 =... | zachriggle/idapython | hrdoc.py | Python | bsd-3-clause | 3,025 | 0.00562 |
"""
Tools to put to good use INE data
""" | JoaquimPatriarca/senpy-for-gis | gasp/ine/__init__.py | Python | gpl-3.0 | 41 | 0.02439 |
#!/usr/bin/python
# (c) 2019, NetApp Inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
"""AWS Cloud Volumes Services - Manage fileSystem"""
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '... | hyperized/ansible | lib/ansible/modules/cloud/amazon/aws_netapp_cvs_FileSystems.py | Python | gpl-3.0 | 12,011 | 0.001915 |
#! /usr/bin/python
# -*- coding: utf-8 -*-
u"""
Finite Horizon Optimal Control
author Atsushi Sakai
"""
import numpy as np
import scipy.linalg as la
def CalcFiniteHorizonOptimalInput(A,B,Q,R,P,N,x0):
u"""
Calc Finite Horizon Optimal Input
# TODO optimize
in: see below
min x'Px+sum(x'Qx+u'Ru... | AtsushiSakai/PyAdvancedControl | finite_horizon_optimal_control/main.py | Python | mit | 2,743 | 0.032446 |
"""
Sysconfig - files in ``/etc/sysconfig/``
========================================
This is a collection of parsers that all deal with the system's configuration
files under the ``/etc/sysconfig/`` folder. Parsers included in this module
are:
ChronydSysconfig - file ``/etc/sysconfig/chronyd``
---------------------... | wcmitchell/insights-core | insights/parsers/sysconfig.py | Python | apache-2.0 | 7,321 | 0.000137 |
# -*- Mode: Python; test-case-name:flumotion.test.test_worker_worker -*-
# 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 modifi... | timvideos/flumotion | flumotion/test/test_worker_medium.py | Python | lgpl-2.1 | 2,617 | 0 |
from django.contrib import admin
from .models import (
Log,
RequestLog,
EventLog,
)
class LogAdmin(admin.ModelAdmin):
readonly_fields = [
'log_level', 'request_url', 'request_method', 'get_data',
'request_body', 'cookies', 'meta',
'exception_type', 'message', 'stack_trace', 'u... | eshandas/simple_django_logger | simple_django_logger/admin.py | Python | mit | 1,281 | 0.000781 |
# -*- coding: utf-8 -*-
#
# 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 (... | apache/bloodhound | bloodhound_multiproduct/tests/versioncontrol/api.py | Python | apache-2.0 | 4,299 | 0.001163 |
'''
Provides several CacheStore backends for Cheetah's caching framework. The
methods provided by these classes have the same semantics as those in the
python-memcached API, except for their return values:
set(key, val, time=0)
set the value unconditionally
add(key, val, time=0)
set only if the server doesn't alr... | mikel-egana-aranguren/SADI-Galaxy-Docker | galaxy-dist/eggs/Cheetah-2.2.2-py2.7-linux-x86_64-ucs4.egg/Cheetah/CacheStore.py | Python | gpl-3.0 | 3,059 | 0.006538 |
import sublime, sublime_plugin
#
# Classic emacs mark ring with multi-cursor support. Each entry in the ring is implemented
# with a named view region with an index, so that the marks are adjusted automatically by
# Sublime. The special region called "jove_mark" is used to display the current mark. It's
# a copy of th... | grundprinzip/sublemacspro | lib/mark_ring.py | Python | bsd-3-clause | 2,686 | 0.004468 |
#!/usr/bin/python
# coding: utf-8
import numpy as np
from keras.models import Sequential, Model, load_model
from keras.optimizers import SGD,Adagrad,RMSprop,Adam
from keras.layers import Dense, Input, Activation
from keras.layers import BatchNormalization, Add, Dropout
from keras import optimizers
from keras.layer... | chrissly31415/amimanera | keras_tools.py | Python | lgpl-3.0 | 10,881 | 0.01351 |
"""Read in lightcurve files."""
import logging
import numpy as np
import astropy.io.ascii as at
def read_single_aperture(filename):
"""Read in one of AMC's K2 light curves,
inputs
------
filename: string
should look like EPIC_205030103_xy_ap1.5_fixbox_cleaned.dat
outputs
-------
... | stephtdouglas/k2spin | k2io.py | Python | mit | 2,475 | 0.006061 |
import numpy as np
import eos
import h5py
# This script converts the Basel Face Model 2017 (BFM2017, [1]) to the eos model format,
# specifically the files model2017-1_face12_nomouth.h5 and model2017-1_bfm_nomouth.h5 from the BFM2017 download.
#
# The BFM2017 does not come with texture (uv-) coordinates. If you have t... | patrikhuber/eos | share/scripts/convert-bfm2017-to-eos.py | Python | apache-2.0 | 3,067 | 0.005546 |
from __future__ import absolute_import
from django.conf import settings
from django.template import Library
from sentry import options
from sentry.utils.assets import get_asset_url
from sentry.utils.http import absolute_uri
register = Library()
register.simple_tag(get_asset_url, name='asset_url')
@register.simpl... | JackDanger/sentry | src/sentry/templatetags/sentry_assets.py | Python | bsd-3-clause | 1,943 | 0.003603 |
# -*- coding: UTF-8 -*-
from collections import defaultdict
from decimal import Decimal
from django import forms
from django import http
from django.conf import settings
from django.conf.urls import url, patterns
from django.contrib import admin
from django.core import urlresolvers
from django.db.models import Q
from d... | barrachri/epcon | p3/admin.py | Python | bsd-2-clause | 27,045 | 0.00281 |
##
# Copyright 2013 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# the Hercules foundation (http://w... | valtandor/easybuild-easyblocks | easybuild/easyblocks/generic/versionindependentpythonpackage.py | Python | gpl-2.0 | 4,223 | 0.002368 |
# Copyright 2018 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import _, fields, models
class ResPartner(models.Model):
_inherit = "res.partner"
_allowed_inactive_link_models = ["res.partner"]
_inactive_cascade = True
sta_mandate_ids = fields.One2many(
... | mozaik-association/mozaik | mozaik_mandate/models/res_partner.py | Python | agpl-3.0 | 3,660 | 0.000273 |
# Copyright © 2020, Joseph Berry, Rico Tabor (opendrop.dev@gmail.com)
# OpenDrop is released under the GNU GPL License. You are free to
# modify and distribute the code, but always under the same license
# (i.e. you cannot make commercial derivatives).
#
# If you use this software in your research, please cite the foll... | ricotabor/opendrop | opendrop/app/common/image_acquisition/configurator/__init__.py | Python | gpl-2.0 | 1,447 | 0 |
# -*- coding: 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 field 'MetricType.unit'
db.add_column(u'schools_metrictype', 'unit',
self.gf(... | formicablu/digischool | schools/migrations/0004_auto__add_field_metrictype_unit.py | Python | gpl-2.0 | 2,337 | 0.007274 |
import os
from setuptools import setup, find_packages
README = open(os.path.join(os.path.dirname(__file__), 'README.md')).read()
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='django-email-subscription',
url='https://github.com/MagicSolutions/django-email-subscrip... | MagicSolutions/django-email-subscription | setup.py | Python | mit | 888 | 0 |
#!/usr/bin/env python
# -*- coding: ascii -*-
"""
package.module
~~~~~~~~~~~~~
A description which can be long and explain the complete
functionality of this module even with indented code examples.
Class/Function however should not be documented here.
:copyright: year by my name, see AUTHORS for more details
:licen... | EPiCS/soundgates | hardware/tools/to_rawdata.py | Python | mit | 1,000 | 0.019 |
# stdlib
from collections import defaultdict
import datetime
import logging
import os
import shutil
import tempfile
# 3p
import xml.etree.ElementTree as ET
# project
from tests.checks.common import AgentCheckTest
logger = logging.getLogger(__file__)
DATETIME_FORMAT = '%Y-%m-%d_%H-%M-%S'
LOG_DATA = 'Finished: SUCCE... | varlib1/servermall | jenkins/test_jenkins.py | Python | bsd-3-clause | 5,889 | 0.000849 |
from collections import Counter
from os.path import splitext
import matplotlib.pyplot as plt
from arcapix.fs.gpfs import ListProcessingRule, ManagementPolicy
def type_sizes(file_list):
c = Counter()
for f in file_list:
c.update({splitext(f.name): f.filesize})
return c
p = ManagementPolicy()
... | arcapix/gpfsapi-examples | type_sizes_piechart.py | Python | mit | 519 | 0.001927 |
# Generated by Django 2.2rc1 on 2019-03-26 13:29
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('questions', '0042_remove_null_true'),
]
operations = [
migrations.AlterModelOptions(
name='catalog',
options={'ordering': (... | rdmorganiser/rdmo | rdmo/questions/migrations/0043_django2.py | Python | apache-2.0 | 1,023 | 0.00391 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.