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 |
|---|---|---|---|---|---|
# Copyright (c) 2020 PaddlePaddle 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 app... | luotao1/Paddle | python/paddle/regularizer.py | Python | apache-2.0 | 5,630 |
#!/usr/bin/env python
#
# VMEncryption extension
#
# Copyright 2015 Microsoft Corporation
#
# 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
#... | thomas1206/azure-linux-extensions | VMEncryption/main/handle.py | Python | apache-2.0 | 47,330 |
"""
Stackoverflow (It)
@website https://stackoverflow.com/
@provide-api not clear (https://api.stackexchange.com/docs/advanced-search)
@using-api no
@results HTML
@stable no (HTML can change)
@parse url, title, content
"""
from urlparse import urljoin
from urllib import urlencode
from lxm... | PwnArt1st/searx | searx/engines/stackoverflow.py | Python | agpl-3.0 | 1,507 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2018, Ansible Project
# Copyright: (c) 2018, Abhijeet Kasurde <akasurde@redhat.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = ty... | hryamzik/ansible | lib/ansible/modules/cloud/digital_ocean/digital_ocean_account_facts.py | Python | gpl-3.0 | 2,100 |
#! /usr/bin/python
# -*- coding: UTF-8 -*-
import sys
import re
import string
import datetime
import getopt
import os
# print os.path.abspath(sys.argv[0]);
# dirname = ;
sys.path.append('/opt/mishkal/lib');
sys.path.append('../lib');
# join the actual dirctory to lib path
# print os.path.join(os.path.dirname(sys.arg... | linuxscout/mishkal | tests/testHarakat.py | Python | gpl-3.0 | 5,327 |
import arcpy, os, json, csv
from portal import additem, shareItem, generateToken, getUserContent, updateItem, getGroupID, deleteItem, getGroupContent
from metadata import metadata
from ESRImapservice import ESRImapservice
class csvportal(object):
def __init__(self, user, password, portal, worksspace, group... | warrieka/portal4argis_tools | portal/csvportal.py | Python | mit | 4,761 |
# -*- coding: utf-8 -*-
#
# RERO ILS
# Copyright (C) 2021 RERO
#
# This program 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, version 3 of the License.
#
# This program is distributed in the hope that... | rero/reroils-app | tests/unit/test_cql_parser.py | Python | gpl-2.0 | 13,069 |
# -*- coding: utf-8 -*-
from __future__ import (unicode_literals, division, absolute_import, print_function)
__license__ = 'GPL 3'
__copyright__ = '''
2011, John Schember <john@nachtimwald.com>,
2006, Ed Summers <ehs@pobox.com>
'''
__docformat__ = 'restructuredtext en'
from contextlib import closing
from lxml impor... | jelly/calibre | src/calibre/utils/opensearch/description.py | Python | gpl-3.0 | 4,538 |
# Copyright 2014-2018 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 w... | lisatn/workload-automation | wa/workloads/vellamo/__init__.py | Python | apache-2.0 | 9,952 |
"""
Implementation of a language model class.
TODO: write more documentation
"""
__docformat__ = 'restructedtext en'
__authors__ = ("Razvan Pascanu "
"KyungHyun Cho "
"Caglar Gulcehre ")
__contact__ = "Razvan Pascanu <r.pascanu@gmail>"
import numpy
import itertools
import logging
impo... | neozhangthe1/coverage_model | groundhog/models/LM_model.py | Python | bsd-3-clause | 10,800 |
#!/var/www/django/treeio/venv/bin/python
#
# The Python Imaging Library
# $Id$
#
# PIL raster font compiler
#
# history:
# 1997-08-25 fl created
# 2002-03-10 fl use "from PIL import"
#
from __future__ import print_function
VERSION = "0.4"
import glob, sys
# drivers
from PIL import BdfFontFile
from PIL import Pc... | havard024/prego | venv/bin/pilfont.py | Python | mit | 1,043 |
from django.core.wsgi import get_wsgi_application
import os
from dj_static import Cling
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "aefat.settings")
application = Cling(get_wsgi_application())
| ouedraog/aefat | aefat/wsgi.py | Python | mit | 203 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
utils.py
~~~~~
:created: 2013-02-10 23:16:24 -0800
:copyright: (c) 2013. Lambda Labs, Inc.
:license: BSD. See LICENSE.
"""
import os
import datetime
from contextlib import closing
import urllib2
import cStringIO
from urlparse import urlparse
from ... | lambdal/lmb | lmb/utils.py | Python | bsd-3-clause | 1,899 |
# Copyright (c) 2012 The Khronos Group Inc.
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and /or associated documentation files (the "Materials "), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publ... | KhronosGroup/COLLADA-CTS | StandardDataSets/1_5/collada/library_effects/effect/profile_COMMON/technique/phong/transparent/effect_phong_transparent_param/effect_phong_transparent_param.py | Python | mit | 7,898 |
""" Enumerations
:Author: Jonathan Karr <karr@mssm.edu>
:Date: 2016-12-09
:Copyright: 2016-2018, Karr Lab
:License: MIT
"""
from enum import Enum, EnumMeta, _EnumDict
class _CaseInsensitiveEnumDict(_EnumDict):
def __setitem__(self, key, value):
# For Python 3
super(_CaseInsensitiveEnumDict, sel... | KarrLab/wc_utils | wc_utils/util/enumerate.py | Python | mit | 1,645 |
#! /usr/bin/env python3
name = input("Enter the name: ")
fobj = open(name)
print(fobj.read())
fobj.close()
| tongxindao/shiyanlou | shiyanlou_cs596-1805f3c438/opentest.py | Python | apache-2.0 | 107 |
import os, sys, nltk, re
import simplejson as json
from lib.tfidf import TfIdf
from customnaivebayes import NaiveBayesClassifier as learner
from nltk.corpus import stopwords
class SentimentClassifier():
"""Classify text on positive or negative sentiment"""
def file_to_list(self, filename):
try:
lines = [line.s... | NealJMD/Grinbox-server | GrinboxClassifiers/sentiment.py | Python | gpl-3.0 | 3,880 |
from django.contrib import admin
from avatars.models import Avatar
admin.site.register(Avatar)
| PrincessTeruko/TsunArt | avatars/admin.py | Python | mit | 97 |
from django.core.management.base import BaseCommand, CommandError
from www.models.rightscale_account import rightscale_account
from www.session_manager import SessionManager
import uuid
class Command(BaseCommand):
help = 'Starts a terminating session for all registered RightScale accounts'
def handle(self, *a... | rgeyer/terminator_for_rs_ss | skynet/management/commands/startsessions.py | Python | mit | 646 |
#!/usr/bin/env python
import sys
import atexit
import threading
from .util import stdin_reset, getch
from verman import Version
readgood_version = Version("readgood", 0, 1, 1, releaselevel="dev",
init_file=__file__)
__version__ = readgood_version.mmm
class state(object):
"""Hold globa... | wasade/readgood | readgood/__init__.py | Python | bsd-3-clause | 1,432 |
#!/usr/bin/python
#
# 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 b... | vanant/googleads-dfa-reporting-samples | python/v2.0/get_user_role_permissions.py | Python | apache-2.0 | 2,441 |
import iolib, datasets, tools
from tools.tools import add_constant, categorical
import regression
from .regression.linear_model import OLS, GLS, WLS, GLSAR
from .regression.quantile_regression import QuantReg
from .genmod.generalized_linear_model import GLM
from .genmod import families
import robust
from .robust.robust... | yarikoptic/pystatsmodels | statsmodels/api.py | Python | bsd-3-clause | 1,198 |
# ===============================================================================
# Copyright 2015 Jake Ross
#
# 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... | UManPychron/pychron | pychron/dvc/dvc_orm.py | Python | apache-2.0 | 19,421 |
'''
A module that conducts unit tests on all top-level methods within each class.
Created on Jun 20, 2012
@author: ccabot
'''
import unittest
import sys
# add to PYTHONPATH
sys.path.append("../")
from libpgm.dictionary import Dictionary
from libpgm.graphskeleton import GraphSkeleton
from libpgm.orderedskeleton impo... | CyberPoint/libpgm | tests/run_unit_tests.py | Python | bsd-3-clause | 14,090 |
import unittest
import StringIO
from packetsexample import PacketsExample
from prers import ClientSubnet2
class TestRcode(unittest.TestCase):
def reinit(self):
self.__stringbuffer1 = StringIO.StringIO()
self.__p1 = ClientSubnet2(self.__stringbuffer1)
def data_example(self):
data = P... | niclabs/ratadns-filters | tests/test_clientsubnet2.py | Python | mit | 3,639 |
""" Convenience wrapper to handle Oauth authentication
"""
import requests
class LiveAuth(object):
""" Live Oauth authentication helper
"""
_base_url = 'https://login.live.com/'
_authorize_uri = 'oauth20_authorize.srf'
_token_url = 'oauth20_token.srf'
def __init__(self, client_id, client_se... | cogniteev/pyonedrive | pyonedrive/live_auth.py | Python | apache-2.0 | 2,151 |
__source__ = 'https://leetcode.com/problems/palindromic-substrings/'
# Time: O(n^2)
# Space: O(mn)
#
# Description: Leetcode # 647. Palindromic Substrings
#
# Given a string, your task is to count how many palindromic substrings in this string.
#
# The substrings with different start indexes or end indexes are counted... | JulyKikuAkita/PythonPrac | cs15211/PalindromicSubstrings.py | Python | apache-2.0 | 3,403 |
from .consts import *
from .factory import SocketFactoryRegistry
from . import txzmq_impl
| cordis/pycloudia | pycloudia/channels/__init__.py | Python | mit | 90 |
"""
General
=======
The Debian Archive Kit web api, AKA the B{FTP-Master api}, allows
anyone to query the database of the Debian archive kit for information
related to the archive. That is, it provides information about the
archive, its suites and all the packages.
Development
-----------
B{NOTE}: B{The ... | Debian/dak | dakweb/__init__.py | Python | gpl-2.0 | 1,410 |
import tensorflow as tf
def main():
a_raw = [
[0.0, 0.0, 1.0, 1.0],
[1.0, 0.0, 0.0, 0.0],
[1.0, 1.0, 0.0, 1.0],
[1.0, 1.0, 0.0, 0.0]
]
beta = 0.85
steps = 7
a = tf.Variable(a_raw, tf.float32)
n = int(a.get_shape()[0])
v = tf.Variable(tf.fill([n, 1], 1 / n)... | garciparedes/python-examples | numerical/tensorflow/pagerank.py | Python | mpl-2.0 | 1,019 |
#!/usr/bin/env python
# encoding: utf-8
"""
TxtToBeamImg.py
Converts a text file to a beamimage h5 file
"""
import numpy as np
import random
from tables import *
import os
path = '/home/sean/data/20121115/'
outfile = path + 'sci4_beammap_left_good.h5'
# make beamap group
h5file = openFile(outfile, mode = "w")
bgro... | bmazin/SDR | Projects/BestBeammap/TxtToBeamImg.py | Python | gpl-2.0 | 2,822 |
import sys
import DataParser
from RedisQueue import RedisQueue
class ParserWorker():
def __init__(self, in_queue_namespace, out_queue_namespace):
self.in_queue_namespace = in_queue_namespace
self.out_queue_namespace = out_queue_namespace
self.in_queue = RedisQueue(in_queue_names... | rirwin/theft-market | trulia-fetcher/ParserWorker.py | Python | mit | 1,024 |
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 23 13:46:53 2015
@author: Gerhard
"""
from Global_counters import Global_counters
from Singleton import Singleton
Global_counters = Global_counters.Instance()
#The Buildinglevel consistis out of 3 connections and 3 blocks Catchment - Household - Raintank
@Singleton
cl... | ChristianF88/CD3Waterbalance | Modelcreator/Buildinglevel.py | Python | gpl-2.0 | 13,342 |
#!/usr/bin/python
# coding: utf-8
class Solution(object):
def fractionToDecimal(self, numerator, denominator):
"""
:type numerator: int
:type denominator: int
:rtype: str
"""
if numerator == 0:
return '0'
neg = False
if numerator > 0 and d... | Lanceolata/code-problems | python/leetcode_medium/Question_090_Fraction_to_Recurring_Decimal.py | Python | mit | 1,247 |
import subprocess
import re
import os
from app import util
BLAME_NAME_REX = re.compile(r'\(([\w\s]+)\d{4}')
def git_path(path):
"""Returns the top-level git path."""
dir_ = path
if os.path.isfile(path):
dir_ = os.path.split(path)[0]
proc = subprocess.Popen(
['git', 'rev-parse', '--sh... | harveyr/thunderbox | app/lintblame/git.py | Python | mit | 2,301 |
import requests, logging, re
from django.core.management.base import BaseCommand, CommandError
from time import localtime, time, mktime
import logging
from django.conf import settings
logger = logging.getLogger("thermostat.stats")
logger.setLevel(settings.LOG_LEVEL)
class Command(BaseCommand):
args = ''
h... | jpardobl/django-thermostat | django_thermostat/management/commands/parse_flame_stats.py | Python | bsd-3-clause | 4,789 |
#!/usr/bin/env python
#
# Pravin Paratey (April 15, 2011)
# Code released under BSD license
class PriorityQueue:
""" This class illustrates a PriorityQueue and its associated functions """
def __init__(self):
self.heap = [
(15, 'http://google.co.uk'),
(13, 'http://yahoo.co.uk')... | pravin/Public-Domain | PriorityQueue.py | Python | apache-2.0 | 4,354 |
__author__ = 'krc'
import config
import logging
# Exceptions
from call_flow_communication import Server_404, Server_400
from call_utils import NotFound
import time
try:
import unittest2 as unittest
except ImportError:
import unittest
from static_agent_pools import Receptionists, Customers
class Stress(uni... | AdaHeads/Coverage_Tests | src/stress_tests.py | Python | gpl-3.0 | 2,392 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2017, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | ywcui1990/nupic.research | projects/location_layer/single_layer_2d_experiment/visualize_confusion.py | Python | agpl-3.0 | 3,013 |
from tkinter import Toplevel, Frame, Button, ACTIVE, LEFT
class Dialog(Toplevel):
def __init__(self, parent, title=None, datapoint=None):
Toplevel.__init__(self, parent)
self.transient(parent)
if title:
self.title(title)
self.parent = parent
self.result = Non... | Isotop7/pyrtemonnaie | tkDatapointDialog.py | Python | mit | 1,655 |
# Copyright 2014 PerfKitBenchmarker 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... | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/providers/aws/aws_disk.py | Python | apache-2.0 | 15,316 |
# Copyright 2019 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... | ghchinoy/tensorflow | tensorflow/python/saved_model/model_utils/mode_keys_test.py | Python | apache-2.0 | 2,347 |
# Como não tinha restrições no enunciado da questão escolhi o python pela facilidade de trabalhar com strings na hora de por os parenteses xD
#codigo foi implementado na versão 2.7.13
import sys
def f(i,j):
return str(i)+','+str(j)
def matrix_chain_order(p):
n = len(p)-1
m, s = {}, {}
for i in... | Scientistt/AnaliseDeAlgoritmosFabioVitorLista02 | Questão 06.py | Python | gpl-3.0 | 1,194 |
#!/usr/bin/env python
import sys
# Generates index.html
# Inserts <script src="..."></script> lines for each map*.js files.
# Read in the template.
f = open('index.html.template', 'r')
s = f.read()
# The list of javascript files are passed as arguments.
scripts = ['<script src="%s"></script>' % x for x in sys.argv[1:... | easies/flatland | flatland/preprocessor/generate_index.py | Python | mit | 449 |
#!/usr/bin/env python
#
# Copyright 2007 Google 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 o... | elsigh/browserscope | third_party/appengine_tools/devappserver2/inotify_file_watcher.py | Python | apache-2.0 | 7,670 |
#
# Copyright 2016 Quantopian, 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 wr... | quantopian/qrisk | empyrical/__init__.py | Python | apache-2.0 | 1,878 |
from unittest import TestCase, main
import tempfile
import os
import sys
import difflib
import svtools.lsort as lsort
class Test_lsort(TestCase):
def test_parser(self):
parser = lsort.command_parser()
args = parser.parse_args('file1 file2 file3'.split())
self.assertEqual(args.vcf_files, ['... | abelhj/svtools | tests/lsort_tests.py | Python | mit | 3,857 |
# Loss recovery calculator P.l. v2.10.10 by Communist in the shell
def lcr():
from termcolor import colored
import cmath
def losS(): #выбрать
global loss
try:
loss = float(input(colored('Введите убыток в % >0 100< : ', 'cyan')))
while True:
if loss >= 100 or loss <= 0:
... | Schiz667/LossCalc | Loss recovery calc.py | Python | mit | 3,979 |
"""
SALTS XBMC Addon
Copyright (C) 2014 tknorris
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.
T... | azumimuo/family-xbmc-addon | plugin.video.salts/scrapers/ororotv_scraper.py | Python | gpl-2.0 | 6,895 |
def semantic_value(x):
if x==0 or x<=2:
return 'Muy bajo'
elif x==3 or x<=5:
return 'Bajo'
elif x==6 or x<=7:
return 'Intermedio'
elif x==8 or x<=9:
return 'Alto'
elif x==10:
return 'Muy alto'
def inference_rules(x,y):
#Este metodo calculo el valor de pertenen... | davidcp90/fuzzysoccer | fufu.py | Python | apache-2.0 | 5,367 |
"""
Copyright (C) 2014 Kompetenzzentrum fuer wissensbasierte Anwendungen und Systeme
Forschungs- und Entwicklungs GmbH (Know-Center), Graz, Austria
office@know-center.at
This program 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 ... | patrickhoefler/linked-data-wizards | ldva/libs/sparql/admin.py | Python | agpl-3.0 | 1,651 |
# libraries needed
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.preprocessing import Imputer
from sklearn.preprocessing import LabelEncoder, OneHotEncoder
from sklearn.cross_validation import train_test_split
from sklearn.preprocessing import StandardScaler
# from StringIO import ... | lancezlin/ml_template_py | DecisionTreeReg/dtr_template.py | Python | mit | 2,300 |
from questionnaire.models import Questionnaire, Section, SubSection, Question, QuestionGroup, QuestionGroupOrder
from django.core import serializers
questionnaire = Questionnaire.objects.get(name="JRF 2013 Core English", description="From dropbox as given by Rouslan")
section_1 = Section.objects.create(order=0,
... | testvidya11/ejrf | questionnaire/fixtures/questionnaire/cover_page.py | Python | bsd-3-clause | 3,536 |
# Copyright (c) 2016-2018, Neil Booth
#
# All rights reserved.
#
# See the file "LICENCE" for information about the copyright
# and warranty status of this software.
'''Mempool handling.'''
import itertools
import time
from abc import ABC, abstractmethod
from asyncio import Lock
from collections import defaultdict
i... | thelazier/electrumx | electrumx/server/mempool.py | Python | mit | 14,815 |
# -- coding: utf-8 --
"""Beautiful Soup
Elixir and Tonic
"The Screen-Scraper's Friend"
http://www.crummy.com/software/BeautifulSoup/
Beautiful Soup parses a (possibly invalid) XML or HTML document into a
tree representation. It provides methods and Pythonic idioms that make
it easy to navigate, search, and modify the ... | tquilian/exeNext | exe/engine/beautifulsoup.py | Python | gpl-2.0 | 79,589 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Chirstoph Reimers'
__email__ = 'creimers@byteyard.de'
__version__ = '0.1.0.b1'
| byteyard/djangocms_shariff | djangocms_shariff/__init__.py | Python | bsd-2-clause | 139 |
""" Implementation of Basic low-level methods.
"""
import decimal
from assumptions import AssumeMeths
# used for canonical ordering of symbolic sequences
# via __cmp__ method:
ordering_of_classes = [
# singleton numbers
'Zero', 'One','Half','Infinity','NaN','NegativeOne','NegativeInfinity',
# numbers
... | certik/sympy-oldcore | sympy/core/basic_methods.py | Python | bsd-3-clause | 11,976 |
#!/usr/bin/python
#
# Copyright 2013 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 b... | caioserra/apiAdwords | examples/adspygoogle/adwords/v201309/basic_operations/add_keywords.py | Python | apache-2.0 | 2,787 |
# -*- coding: utf-8 -*-
#
# 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
... | btallman/incubator-airflow | tests/operators/__init__.py | Python | apache-2.0 | 706 |
import unittest
import socket
import six
from restless.utils import json
from restless.constants import UNAUTHORIZED
def _newer_or_equal_(v):
for i in six.moves.xrange(min(len(v), len(version_info))):
expected, tnd = v[i], version_info[i]
if tnd > expected:
return True
elif tn... | toastdriven/restless | tests/test_tnd.py | Python | bsd-3-clause | 10,418 |
"""
Deal with graphic elements
"""
import arcpy
def get_elem_by_name(mxd, names, elm_type="TEXT_ELEMENT"):
elms = arcpy.mapping.ListLayoutElements(
mxd, elm_type)
names = [names] if type(names) == str or type(names) == unicode else \
names if type(names) == list or type(names) == dict els... | JoaquimPatriarca/senpy-for-gis | gasp/arcgis/maps/graph.py | Python | gpl-3.0 | 883 |
# Copyright (c) 2015,Vienna University of Technology,
# Department of Geodesy and Geoinformation
# 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... | skaser/Exercise-1 | ex1/dates_times.py | Python | mit | 3,085 |
from django.db.models.fields import Field
from django.db.models.sql.expressions import SQLEvaluator
from django.utils.translation import ugettext_lazy as _
from django.contrib.gis import forms
from django.contrib.gis.db.models.proxy import GeometryProxy
from django.contrib.gis.geometry.backend import Geometry, Geometry... | edisonlz/fruit | web_project/base/site-packages/django/contrib/gis/db/models/fields.py | Python | apache-2.0 | 11,660 |
# 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... | klmitch/python-keystoneclient | keystoneclient/tests/unit/utils.py | Python | apache-2.0 | 6,995 |
import requests
import logging
from datetime import *
from requests_toolbelt.utils import dump
from awsauth import S3Auth
# host = 'yuliyangdebugwebjewel.tunnel.qydev.com'
host = 'yuliyangdebugweb68.tunnel.qydev.com'
host = '10.254.9.20:7480'
host = '127.0.0.1:7480'
logging.basicConfig(level=logging.DEBUG)
access_key =... | wzyuliyang/ceph-note | aws2/python/usage_count/putCurrentBucket.py | Python | mit | 656 |
#!/usr/bin/python
# MIT License
#
# Copyright (c) 2017 John Bryan Moore, Sampath Vanimisetti
#
# 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 limita... | ibarbech/learnbot | learnbot_components/laser/python/VL53L0X_example_livegraph.py | Python | gpl-3.0 | 1,899 |
"""
Support for Nest thermostats and protect smoke alarms.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/thermostat.nest/
"""
import logging
import socket
import voluptuous as vol
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
REQUIREME... | mikaelboman/home-assistant | homeassistant/components/nest.py | Python | mit | 1,534 |
"""
WSGI config for med_project 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_APPLICATIO... | Uran198/med | config/wsgi.py | Python | bsd-3-clause | 1,624 |
#!/usr/bin/env python
from __future__ import print_function
from argparse import ArgumentParser
from calendar import SUNDAY
from datetime import datetime, timedelta
from grandfatherson import to_delete
from libcloud.storage.types import Provider
from libcloud.storage.providers import get_driver
from pprint import ppri... | evolution/wordpress | lib/ansible/roles/snapshots/files/backup.py | Python | mit | 19,277 |
"""add_biobank_identifier
Revision ID: 32d414bc9a1e
Revises: 9b93d00a35cc
Create Date: 2018-01-30 11:12:24.111826
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "32d414bc9a1e"
down_revision = "9b93d00a35cc"
branch_labels = None
depends_on = None
def upgrade(e... | all-of-us/raw-data-repository | rdr_service/alembic/versions/32d414bc9a1e_add_biobank_identifier.py | Python | bsd-3-clause | 1,163 |
from os.path import abspath, exists, basename, dirname, join, realpath
from os import makedirs, unlink, readlink, rmdir
from alibuild_helpers import __version__
from alibuild_helpers.analytics import report_event
from alibuild_helpers.log import debug, error, info, banner, warning
from alibuild_helpers.log import dieOn... | alisw/alibuild | alibuild_helpers/build.py | Python | gpl-3.0 | 51,895 |
# Copyright 2020 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... | tensorflow/tensorflow | third_party/gpus/find_rocm_config.py | Python | apache-2.0 | 13,594 |
import unittest, random, sys, time
sys.path.extend(['.','..','../..','py'])
import h2o, h2o_cmd, h2o_import as h2i, h2o_exec, h2o_glm, h2o_jobs
class Basic(unittest.TestCase):
def tearDown(self):
h2o.check_sandbox_for_errors()
@classmethod
def setUpClass(cls):
h2o.init(java_heap_GB=10)
... | rowhit/h2o-2 | py/testdir_single_jvm/test_GLM2_basic.py | Python | apache-2.0 | 3,531 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2016-2020 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... | The-Compiler/qutebrowser | qutebrowser/browser/webengine/interceptor.py | Python | gpl-3.0 | 9,261 |
# Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
from jax.tree_util import register_pytree_node_class
@register_pytree_node_class
class PytreeTrace:
def __init__(self, trace):
self.trace = trace
def tree_flatten(self):
trace, aux_trace = {}, {}
for ... | pyro-ppl/numpyro | numpyro/ops/pytree.py | Python | apache-2.0 | 2,206 |
import six
from chainer import cuda
from chainer import function
from chainer.utils import type_check
class Tile(function.Function):
"""Tiling of an array."""
def __init__(self, reps):
if isinstance(reps, six.integer_types):
self.reps = (reps,)
elif isinstance(reps, tuple) and al... | kiyukuta/chainer | chainer/functions/array/tile.py | Python | mit | 2,403 |
from setuptools import setup
setup_args = {
'name': 'mathutils',
'version': '0.0.1',
'author': 'Mkhanyisi Madlavana',
'author_email': "mkhanyisi@gmail.com",
'install_requires': [],
'packages': ['mathutils', 'mathutils.games'],
}
setup(**setup_args)
| dopstar/mathutils | setup.py | Python | gpl-3.0 | 275 |
import sys
import click
@click.command('blackout', short_help='Suppress alerts')
@click.option('--environment', '-E', metavar='ENVIRONMENT', help='Environment eg. Production, Development')
@click.option('--service', '-S', metavar='SERVICE', multiple=True, help='List of affected services eg. app name, Web, Network, S... | alerta/python-alerta-client | alertaclient/commands/cmd_blackout.py | Python | apache-2.0 | 2,169 |
# Copyright 2013 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.
import command_executor
from command_executor import Command
from webelement import WebElement
class ChromeDriverException(Exception):
pass
class NoSuchE... | mogoweb/chromium-crosswalk | chrome/test/chromedriver/client/chromedriver.py | Python | bsd-3-clause | 8,922 |
def convert_to_celsius(fahrenheit):
""" (number) -> float
Return the number of Celsius degrees equivalent to fahrenheit degrees.
>>> convert_to_celsius(75)
23.88888888888889
"""
return (fahrenheit - 32.0) * 5.0 / 9.0
def above_freezing(celsius):
""" (number) -> b... | simontakite/sysadmin | pythonscripts/practicalprogramming/modules/temperature.py | Python | gpl-2.0 | 507 |
#! /usr/bin/env python3
'''List help on all of the devices.'''
import argparse
import os
import sys
if __name__ == '__main__':
sys.path.append (os.path.abspath (os.path.join (os.path.dirname (__file__),
'../..')))
import hj.device
import hj.util.args
... | al-niessner/HikingJournal | hj/tool/device.py | Python | gpl-3.0 | 1,172 |
# Copyright (c) 2012-2013 Andreas Sembrant
# 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 of conditi... | uart/powersleuth | pypowersleuth/dispatcher.py | Python | bsd-3-clause | 2,555 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2013 OpenStack 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... | raildo/keystone | keystone/quota/core.py | Python | apache-2.0 | 3,051 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
depends_on = (
("lizard_area", "0018_auto__add_arealink"),
)
def forwards(self, orm):
# Adding model 'ValueType'
db... | lizardsystem/lizard-layers | lizard_layers/migrations/0001_initial.py | Python | gpl-3.0 | 10,230 |
# Copyright 2010 Hakan Kjellerstrand hakank@bonetmail.com
#
# 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 ... | AlperSaltabas/OR_Tools_Google_API | examples/python/crypto.py | Python | apache-2.0 | 3,704 |
import spotipy
# Get access to Spotify API to get track audio features (updated June 5, 2017).
# Plug in the client ID and client secret you get from the registering with the Spotify API
from spotipy.oauth2 import SpotifyClientCredentials
client_credentials_manager = SpotifyClientCredentials(client_id='YOUR_CLIE... | tgj505/Spotify-clusters | find_related_artists.py | Python | gpl-3.0 | 1,331 |
import copy
import datetime
import logging
from casexml.apps.case.models import CommCareCase
from corehq.apps.change_feed import topics
from corehq.apps.change_feed.consumer.feed import KafkaChangeFeed, MultiTopicCheckpointEventHandler
from corehq.elastic import get_es_new
from corehq.form_processor.backends.sql.dbacc... | qedsoftware/commcare-hq | corehq/pillows/case.py | Python | bsd-3-clause | 3,213 |
# vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
from powerline.theme import requires_segment_info
conn = None
def calcgrp(w):
group = []
if w['focused']:
group.append('w_focused')
if w['urgent']:
group.append('w_urgent')
if w['visible']:
... | seanfisk/powerline | powerline/segments/i3wm.py | Python | mit | 1,765 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# test_detect_face.py
import rospy
from std_msgs.msg import Bool
from sensor_msgs.msg import CompressedImage
import sys
import cv2
import numpy as np
class DetectFace:
def __init__(self):
rospy.init_node('detect_face')
self.pub = rospy.Publisher('/en... | utmi-2014/utmi-ros-enshu | enshu20141204/scripts/group15/test_detect_face.py | Python | mit | 2,428 |
#!/usr/bin/env python
#coding=utf-8
import os,sys
from bottle import request,route,error,run,default_app
from bottle import template,static_file,redirect,abort
import psycopg2
import logging
import uuid
from beaker.middleware import SessionMiddleware
from bottle import TEMPLATE_PATH
import time
import hashlib
import js... | zhengjue/mytornado | task/assets/js/osyw.py | Python | gpl-3.0 | 16,422 |
# -*- coding: utf-8 -*-
import pandas as pd
import numpy as np
import keras
# Part 1
# Training & Testing Data Initialization
data = pd.read_csv("D:\\Manuscript 5\\3 Result\\1 FeatureExtraction\\cleaned_data.csv")
# len(data) = 403624
test = data[:80000] # about 20% used as testing
train = data[80000:] # w... | albertwang21/LoanSelect | NeuralBased/2 Paramecium 5.0.py | Python | mit | 7,269 |
# -*- coding: utf-8 -*-
import os
"""
Fisher-Yates/Knuth
------------------
Randomly picks integers to swap elements in an ubiased manner.
Time Complexity: O(n)
Space Complexity: O(n)n
Pseudocode: http://http://rosettacode.org/wiki/Knuth_shuffle
"""
from random import seed, randint
def shuff... | NicovincX2/Python-3.5 | Algorithmique/Mathématiques discrètes/Combinatoire/Permutation aléatoire/Mélange de Fisher-Yates/fisher_yates_shuffle1.py | Python | gpl-3.0 | 660 |
#-*- coding: utf-8 -*-
from decimal import Decimal
from django.conf import settings
from django.conf.urls.defaults import patterns, url, include
from django.contrib.sites.models import get_current_site
from django.core.urlresolvers import reverse
from django.shortcuts import render_to_response
from django.template imp... | arteria/django-shop-paypal | shop_paypal/offsite_paypal.py | Python | bsd-3-clause | 5,856 |
from amonone.sms.sender import render_template
from nose.tools import *
import unittest
# class SMSRenderTest(unittest.TestCase):
# def render_test(self):
# alert = {"rule_type" : "server", "metric_type_value" : "%", "threshold" : "10",
# "metric_value" : "10", "metric_type" : "more_than", "metric" : "CPU",
# ... | southwolf/amonone | amonone/sms/tests/sms_sender_test.py | Python | mit | 1,471 |
# 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 a... | panmari/tensorflow | tensorflow/python/ops/common_shapes.py | Python | apache-2.0 | 18,546 |
#!/usr/bin/env python3
import random, os, sys
from subprocess import check_output
# first argument is the correct program
correct_program = "solution"
in_file = "test_gen.in"
for index in range(1,20):
in_str = ""
n = random.randint(1,10000)
in_str += str(n) + "\n"
correct_out = ""
with open(i... | ArVID220u/judge | problems/siffersumma/test_generator.py | Python | mit | 746 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from selenium.webdriver.common.by import By
from pages.firefox.base import FirefoxBasePage
class FirefoxWelcomePage1(... | sgarrity/bedrock | tests/pages/firefox/welcome/page1.py | Python | mpl-2.0 | 880 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-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... | pkill-nine/qutebrowser | qutebrowser/completion/models/configmodel.py | Python | gpl-3.0 | 3,647 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC.
# 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/l... | sileht/deb-openstack-quantum | quantum/plugins/cisco/tests/unit/test_cisco_extension.py | Python | apache-2.0 | 53,215 |
from tempfile import NamedTemporaryFile
import os
import re
from . import process
from .utils import tempdir
from ._compat import unicode
from passpie.utils import which
GPG_HOMEDIR = os.path.expanduser('~/.gnupg')
DEVNULL = open(os.devnull, 'w')
KEY_INPUT = u"""%echo Generating Passpie OpenPGP key
Key-Type: DSA
Ke... | marcwebbie/passpie | passpie/crypt.py | Python | mit | 5,300 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.