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
#!/usr/bin/env python """ Download all the fic you've saved in Pinboard. This saves the ebook, PDF and HTML copies available through the "Download" button. See https://alexwlchan.net/2020/05/downloading-the-ao3-fics-that-i-ve-saved-in-pinboard/ Last updated 17 May 2020. """ from __future__ import print_function i...
alexwlchan/alexwlchan.net
src/_files/2020/download_ao3_bookmarks_from_pinboard.py
Python
mit
6,178
"""The tests for the MaryTTS speech platform.""" import os import shutil from unittest.mock import patch import pytest from homeassistant.components.media_player.const import ( ATTR_MEDIA_CONTENT_ID, DOMAIN as DOMAIN_MP, SERVICE_PLAY_MEDIA, ) import homeassistant.components.tts as tts from homeassistant.s...
rohitranjan1991/home-assistant
tests/components/marytts/test_tts.py
Python
mit
3,689
import pytest from insights.parsers import uname from insights.tests import context_wrap from distutils.version import LooseVersion, StrictVersion import doctest UNAME1 = "Linux foo.example.com 2.6.32-504.el6.x86_64 #1 SMP Tue Sep 16 01:56:35 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux" UNAME2 = "Linux rhel7box 3.10.0-...
RedHatInsights/insights-core
insights/parsers/tests/test_uname.py
Python
apache-2.0
20,093
# Copyright 2012 Spanish National Research Council # # 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...
enolfc/keystone-voms
tests/test_middleware_voms_authn.py
Python
apache-2.0
23,887
# 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...
karllessard/tensorflow
tensorflow/lite/testing/op_tests/reduce.py
Python
apache-2.0
8,524
#Based on the generic csv so we are able to import OpenVAS scans exported in CSV __author__ = 'dkade' # Twitter: @DMLoureiro
Prakhash/security-tools
external/django-DefectDojo-1.2.1/dojo/tools/openvas_csv/__init__.py
Python
apache-2.0
125
# -*-coding: utf-8 -*- from zope.interface import implementer from ..interfaces import ( IResourceType, ) from ..resources import ( ResourceTypeBase, ) from ..lib.utils.common_utils import translate as _ @implementer(IResourceType) class ResourcesTypesResource(ResourceTypeBase): __name__ = 'resources_ty...
mazvv/travelcrm
travelcrm/resources/resources_types.py
Python
gpl-3.0
643
# # Copyright (c) 2015 by Julio Seña. All Rights Reserved. # ''' El empleador esta celebrando aniversario y ofrecera a sus clientes una serie de ofertas que se traduciran en incremeno de sus ventas. Las reglas de la ofertas se basan en un porcentaje de descuento sobre el total de compra, que estarian variando dependien...
jcsena/uip-prog3
laboratorios/3/lab.py
Python
mit
1,544
import math def main(): var = int(input("enter number of days: ") ) if ( var > 0 and var <= 365 ): n = math.pow(2, var-1) m = n / 100 print("You earned : $%s"%m) else: while True: print("entered invalid days") var = int(input("enter number of days: ") )...
stirumer/Python
Python #3/number.py
Python
mit
519
TWOPI = 6.28318530717958 BLACK = (0, 0, 0) WHITE = (1, 1, 1) GRAY = (.5,) * 3 DARK_GRAY = (.2,) * 3 LIGHT_GRAY = (.7,) * 3 RED = (1, 0, 0) GREEN = (0, 1, 0) BLUE = (0, 0, 1) YELLOW = (1, 1, 0) TURQUOISE = (0, 1, 1) FUCHSIA = (1, 0, 1) ORANGE = (1, .5, 0) PURPLE = (.5, 0, 1) LIGHT_GREEN = (.5, 1, .5) LIGHT_BLUE = (.5...
astumpf/gagar
gagar/drawutils.py
Python
gpl-3.0
7,411
# -*- coding: utf-8 -*- """ @author: Federico Cerchiari <federicocerchiari@gmail.com> """ import os import html import unittest from collections import Counter from tempy import T, Tag, VoidTag from tempy.tempy import DOMElement from tempy.tags import Div, A, Br, Doctype, Comment class TestTag(unittest.TestCase): ...
Hrabal/TemPy
tests/test_t.py
Python
apache-2.0
6,143
# # @BEGIN LICENSE # # Psi4: an open-source quantum chemistry software package # # Copyright (c) 2007-2018 The Psi4 Developers. # # The copyrights for code used from other parties are included in # the corresponding files. # # This file is part of Psi4. # # Psi4 is free software; you can redistribute it and/or modify #...
amjames/psi4
psi4/share/psi4/databases/NHTBH.py
Python
lgpl-3.0
36,605
from __future__ import absolute_import, unicode_literals import logging import os from abc import ABCMeta from six import add_metaclass from virtualenv.info import fs_supports_symlink from virtualenv.util.path import Path from virtualenv.util.six import ensure_text from ..creator import Creator, CreatorMeta class...
pypa/virtualenv
src/virtualenv/create/via_global_ref/api.py
Python
mit
4,357
""" missing types & inference """ import numpy as np from pandas._libs import lib import pandas._libs.missing as libmissing from pandas._libs.tslibs import NaT, iNaT from .common import ( _NS_DTYPE, _TD_DTYPE, ensure_object, is_bool_dtype, is_complex_dtype, is_datetime64_dtype, is_datetime...
kushalbhola/MyStuff
Practice/PythonApplication/env/Lib/site-packages/pandas/core/dtypes/missing.py
Python
apache-2.0
15,882
class Solution(object): def helper(self, nums, target, f, s, res): l = s + 1 r = len(nums) - 1 while l < r: sum = nums[f] + nums[s] + nums[l] + nums[r] if sum < target: l += 1 elif sum > target: r -= 1 else: ...
hawkphantomnet/leetcode
4Sum/Solution.py
Python
mit
1,392
import math lower_bound = 123456789 upper_bound = 987654321 def is_pandigital(n): if n < lower_bound or n > upper_bound: return False else: to_cover = [1, 2, 3, 4, 5, 6, 7, 8, 9] for i in range(1, 10): curr = n % 10 print(curr, n) if curr in to_cove...
kylebegovich/ProjectEuler
Python/Solved/Page1/Problem38.py
Python
gpl-3.0
1,553
# -*- encoding: utf-8 -*- ############################################################################## # # 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, either version 3 of the...
StefanRijnhart/odoomrp-wip
product_pricelist_rules/models/product_pricelist.py
Python
agpl-3.0
8,524
#!/usr/bin/env python3 def FindMergeNode(headA, headB): nodeA, nodeB = headA, headB lenA = lenB = 0 while nodeA.next: nodeA = nodeA.next lenA += 1 while nodeB.next: nodeB = nodeB.next lenB += 1 nodeA, nodeB = headA, headB while lenA > lenB: nodeA = nodeA....
Oleg-Pulatov/everything
algorithms/find_merge_ll.py
Python
gpl-3.0
533
# 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 # distributed under the...
metacloud/python-cinderclient
cinderclient/tests/utils.py
Python
apache-2.0
2,053
# Opus/UrbanSim urban simulation software. # Copyright (C) 2005-2009 University of Washington # See opus_core/LICENSE from opus_core.variables.variable import Variable from variable_functions import my_attribute_label class total_improvement_value(Variable): """Sum of all improvement values for this gridc...
christianurich/VIBe2UrbanSim
3rdparty/opus/src/urbansim/gridcell/total_improvement_value.py
Python
gpl-2.0
1,833
# 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...
zhouyao1994/incubator-superset
superset/views/database/forms.py
Python
apache-2.0
8,101
# Copyright (c) 2017 Anidata # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute,...
anidata/palantiri
palantiri/core/common.py
Python
mit
2,745
#!/usr/bin/env python3 from typing import Tuple import numpy as np def rotator(A: np.ndarray, i: int, j: int, k: int) -> np.ndarray: G = np.eye(A.shape[0]) r = np.sqrt(A[i, k] ** 2 + A[j, k] ** 2) if A[j, k] != 0: G[i, i] = A[i, k] / r G[i, j] = A[j, k] / r G[j, i] = - A[j, k] / ...
garciparedes/python-examples
numerical/math/algebra/matrix_decomposition/qr/givens_rotations.py
Python
mpl-2.0
1,431
from time import strftime from twisted.python.logfile import LogFile from twisted.enterprise import adbapi from twisted.python import log class PotFactory: dbpool = None def __init__(self, logfile=None, dburl=None): self.logfile = logfile if dburl: from re import match ...
lanjelot/twisted-honeypots
python/common.py
Python
gpl-2.0
1,264
############################################################################################## # Copyright 2014-2015 Cloud Media Sdn. Bhd. # # This file is part of Xuan Application Development SDK. # # Xuan Application Development SDK is free software: you can redistribute it and/or modify # it under the terms of...
TheStackBox/xuansdk
SDKLibrary/com/cloudMedia/theKuroBox/sdk/app/module.py
Python
gpl-3.0
15,187
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings import apps.users.models class Migration(migrations.Migration): dependencies = [ ('users', '0006_auto_20150422_1649'), ] operations = [ migrations.Al...
azavea/nyc-trees
src/nyc_trees/apps/users/migrations/0007_auto_20150505_1155.py
Python
agpl-3.0
4,985
""" Based entirely on Django's own ``setup.py``. """ import os import sys from distutils.command.install_data import install_data from distutils.command.install import INSTALL_SCHEMES try: from setuptools import setup except ImportError: from distutils.core import setup # NOQA class osx_install_data(install_...
rosscdh/django-abridge
setup.py
Python
mit
3,202
# This should be extended for each Python release. # The product code must change whenever the name of the MSI file # changes, and when new component codes are issued for existing # components. See "Changing the Product Code". As we change the # component codes with every build, we need a new product code # each time. ...
invisiblek/python-for-android
python3-alpha/python3-src/Tools/msi/uuids.py
Python
apache-2.0
5,925
#!/usr/bin/env python """ client module for memcached (memory cache daemon) Overview ======== See U{the MemCached homepage<http://www.danga.com/memcached>} for more about memcached. Usage summary ============= This should give you a feel for how this module operates:: import memcache mc = memcache.Client(...
philipn/sycamore
Sycamore/support/memcache.py
Python
gpl-2.0
34,758
#!/usr/bin/env python # A simple feedforward neural network that learns XOR. __author__ = 'Tom Schaul, tom@idsia.ch' from datasets import SequentialXORDataSet #@UnresolvedImport from pybrain.tools.shortcuts import buildNetwork from pybrain.supervised import BackpropTrainer def testTraining(): d = SequentialXOR...
firestrand/pybrain-gpu
examples/supervised/backprop/xor.py
Python
bsd-3-clause
572
#!/usr/bin/env python import os import json from common.utils import oceanus_logging, convert2jst from bigquery import get_client from datetime import date, timedelta from task.sendgrid.tasks import send2email from jinja2 import Environment, FileSystemLoader PATH = os.path.dirname(os.path.abspath(__file__)) jinja2_en...
uyamazak/oceanus
revelation/app/task/googlebigquery/googlebigquery.py
Python
mit
3,977
# coding: utf-8 # Please be aware that this example needs 5 - 6 GB of RAM and approx. 40 minutes to run # In[ ]: get_ipython().magic(u'load_ext autoreload') get_ipython().magic(u'autoreload 2') # In[ ]: import riverConflation as rc import os import networkx as nx # In[ ]: #both datasets used for testing can b...
artttt/RiverConflation
conflationExample.py
Python
mit
4,891
import os from collections import Generator import h5py import numpy as np from keras.utils import Sequence from groundwater_timenet import utils from groundwater_timenet.learn.settings import * logger = utils.setup_logging(__name__, utils.PARSE_LOG, "INFO") class BaseGenerator(Generator): def __init__(self,...
RoelvandenBerg/groundwater_timenet
groundwater_timenet/learn/generator.py
Python
gpl-3.0
7,123
# -*- encoding: utf-8 -*- ############################################################################## # # Purchase - Computed Purchase Order Glue Module for Sale for Odoo # Copyright (C) 2013-Today GRAP (http://www.grap.coop) # @author Julien WESTE # @author Sylvain LE GAL (https://twitter.com/legalsylva...
factorlibre/odoo-addons-cpo
purchase_compute_order_sale/model/product_product.py
Python
agpl-3.0
2,001
#! /usr/bin/python # Written By Tom Paulus, @tompaulus, www.tompaulus.com from lib.tidylib import tidy_document from modules.properties import Property class GenEmail(object): temp_summary = """<tr> <td valign="top" class="preheaderContent" style="padding-top:10px; padding-right:...
tpaulus/MorningMailer
modules/html.py
Python
apache-2.0
7,485
"""Provides shared constants.""" from __future__ import absolute_import import enum __all__ = ('ExitCode',) class ExitCode(enum.IntEnum): """Exit codes used by the CLI, in the range 64-113.""" CONNECTION_FAILURE = 64 SERVICES_NOT_FOUND = 65
darvid/proxenos
src/proxenos/const.py
Python
mit
259
# -*- coding: utf-8 -*- """ Created on Wed Oct 04 10:57:34 2017 @author: Gerwyn """ from __future__ import division import numpy as np import scipy as sp import scipy.interpolate as spi import scipy.stats as sps import matplotlib.pyplot as plt plt.close('all') def cubic_spline(x, x_data, y_data, s_data, t_data, ...
Gezerj/Data-Analysis
Assignments/Blank.py
Python
gpl-3.0
7,542
""" 问题描述:给定一个单链表的头结点head,实现一个调整单链表的函数,使得每K个节点之间逆序, 如果最后不够k个节点一组,则不调整最后几个节点。 例如:k = 3时 链表:1->2->3->4->5->6->7->8->None 调整后:3->2->1->6->5->4->7->8->None,7、8不调整,因为不够一组 思路: 1)使用辅助栈或者队列来做n*k个节点的倒置 2)直接使用有限(四个)变量来解决该问题,left表示每k个节点的前一个,start表示每k个节点 的第一个,end表示每k个节点的最后一个,right表示每k个节点的最后一个的下一个。在翻转之前, 有关系:left.next = start end....
ResolveWang/algrithm_qa
linkedlist/q12.py
Python
mit
2,836
from django.db import models # Create your models here. """ Choice Options """ COMP_STATUS_CHOICES = ( ('Entry', 'Entry'), ('StandBy', 'Stand By'), ('OnGoing', 'On Going'), ('Result', 'Result'), ) SEX_CHOICES = ( ('M', '男'), ('W', '女'), ('U', 'Unknown'), ) ORDER_CHOICES = ( ('ASC', '...
tafdata/cardinal
app/competitions/models.py
Python
mit
6,647
import logging as log class Mail(object): def __init__(self, page_html = ''): from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart self.message = MIMEMultipart() self.message.attach(MIMEText(page_html.encode('utf-8'), 'html','utf-8')) self.ema...
xgrg/slack-integrations
bbrc/xnat/mailing.py
Python
mit
6,665
import math import unicornhat as unicorn from pijobs.unicorndemo import UnicornDemo # Based on Pimoroni example code: # https://github.com/pimoroni/unicorn-hat class SwirlJob(UnicornDemo): def effect(self, x, y, step): x -= (self.cols / 2) y -= (self.rows / 2) dist = math.sqrt(pow(x, 2) +...
ollej/piapi
pijobs/swirljob.py
Python
mit
611
#!/usr/bin/env python # Import the file being tested from piheat import * # Remove the 'FileHandler' set in piheat.py so that output from the test suite can be logged in a different file. log = logging.getLogger() for hdlr in log.handlers[:]: # remove all old handlers log.removeHandler(hdlr) # Set the logging...
tj78/piheat
src/test_piheat.py
Python
gpl-3.0
11,726
#!/usr/bin/env python from tdclient.model import Model class User(Model): """User on Treasure Data Service """ def __init__(self, client, name, org_name, role_names, email, **kwargs): super(User, self).__init__(client) self._name = name self._org_name = org_name self._rol...
treasure-data/td-client-python
tdclient/user_model.py
Python
apache-2.0
860
{'level_mc': {'_txt': {'text': '6'}, 'currentLabel': 'up', 'progress_mc': {'currentLabel': '_0'}}}
ethankennerly/hotel-vs-gozilla
user/h4.news.py
Python
mit
126
import numpy as np import pymc datapoints = 50 # create some fake data x = np.arange(datapoints) * 0.45 f = 0.15 * x**2 - 3.35 * x - 7.35 #create some noise and add to the data noise = np.random.normal(size=datapoints) * 2.5 f += noise #add crazy outliers f[15] = -5 f[32] = -15 f[34] = -31 #fit polynomial using the ...
sniemi/SamPy
statistics/bayesian/testmodel.py
Python
bsd-2-clause
875
from sqlalchemy import Table, Column, String, func, MetaData, select, TypeDecorator, cast from sqlalchemy.testing import fixtures, AssertsCompiledSQL from sqlalchemy import testing from sqlalchemy.testing import eq_ class _ExprFixture(object): def _fixture(self): class MyString(String): def bi...
alex/sqlalchemy
test/sql/test_type_expressions.py
Python
mit
8,295
#!/usr/bin/env python """ @file My_mpl_dump_onNet.py @author Daniel Krajzewicz @author Sascha Krieg @author Michael Behrisch @date 2007-10-25 @version $Id: My_mpl_dump_onNet.py 14425 2013-08-16 20:11:47Z behrisch $ This script reads a network and a dump file and draws the network, coloring it by the values ...
cathyyul/sumo-0.18
tools/projects/TaxiFCD_Krieg/src/fcdToRoutes/My_mpl_dump_onNet.py
Python
gpl-3.0
18,279
GROUP_INDEX = "hqgroups_htj2o87ep2rugag3k46hh2a67tn0r8d9" GROUP_MAPPING = { "date_formats": [ "yyyy-MM-dd", "yyyy-MM-dd'T'HH:mm:ssZZ", "yyyy-MM-dd'T'HH:mm:ss.SSSSSS", "yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'", "yyyy-MM-dd'T'HH:mm:ss'Z'", "yyyy-MM-dd'T'HH:mm:ssZ", "yyy...
SEL-Columbia/commcare-hq
corehq/pillows/mappings/group_mapping.py
Python
bsd-3-clause
1,716
from xml.etree import ElementTree import version class XMLElement(object): def __init__(self): self.source = None def xml(self): element = ElementTree.Element(self.tag, self.attrib) if self.source: try: sources = iter(self.source) except TypeE...
Sciumo/PDAL
python/pdal/pipeline_xml.py
Python
bsd-3-clause
1,304
# # Gramps - a GTK+/GNOME based genealogy program # # Copyright (C) 2002-2006 Donald N. Allingham # Copyright (C) 2011 Tim G L Lyons # # 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...
pmghalvorsen/gramps_branch
gramps/gen/filters/rules/citation/_citationprivate.py
Python
gpl-2.0
1,680
"""Aruba OS support""" from __future__ import unicode_literals import time import re from netmiko.cisco_base_connection import CiscoSSHConnection class ArubaSSH(CiscoSSHConnection): """Aruba OS support""" def session_preparation(self): """Aruba OS requires enable mode to disable paging.""" del...
michaelrosejr/pyaos6
netmiko/aruba/aruba_ssh.py
Python
mit
1,008
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('teams', '0006_team_plan'), ] operations = [ migrations.AddField( model_name='team', name='disabled',...
reneetrei/agile-bayou-76491
teams/migrations/0007_team_disabled.py
Python
mit
392
# SVR # Importing the libraries import numpy as np import matplotlib.pyplot as plt import pandas as pd # Importing the dataset dataset = pd.read_csv('Position_Salaries.csv') X = dataset.iloc[:, 1:2].values y = dataset.iloc[:, 2].values # Splitting the dataset into the Training set and Test set """from sklearn.cross_...
Fenrir12/Master_BCG_EEG
Cours/Machine Learning - UDEMY/Machine Learning A-Z/Part 2 - Regression/Section 7 - Support Vector Regression (SVR)/svr.py
Python
apache-2.0
1,041
from flask import Flask, render_template app = Flask(__name__) @app.route('/') def home(): return render_template('home.html') @app.route('/about') def about(): return render_template('about.html') if __name__ == '__main__': app.run(debug=True)
sredmond/ms-gc-webapp
app/routes.py
Python
mit
263
""" Module to define url helpers functions """ from urllib import urlencode from xmodule.modulestore.search import path_to_location, navigation_index from xmodule.modulestore.django import modulestore from django.core.urlresolvers import reverse def get_redirect_url(course_key, usage_key): """ Returns the redirec...
ampax/edx-platform
lms/djangoapps/courseware/url_helpers.py
Python
agpl-3.0
2,183
"""parses configuration and returns useful things""" class BigqueryMixin(object): """parses configuration files""" @property def bigquery_dataset_id(self): """stuff""" return self.config.get('bigquery_dataset_id') @property def bigquery_table_id(self): """stuff""" ...
pantheon-systems/etl-framework
gcloud/configs/mixins/bigquery.py
Python
mit
366
#! /usr/bin/env python # -*- coding: UTF8 -*- # Este arquivo é parte do programa Vitollino # Copyright 2014-2017 Carlo Oliveira <carlo@nce.ufrj.br>, # `Labase <http://labase.selfip.org/>`__; `GPL <http://j.mp/GNU_GPL3>`__. # # Vitollino é um software livre; você pode redistribuí-lo e/ou # modificá-lo dentro dos termos ...
labase/vitollino
src/lab/__init__.py
Python
gpl-3.0
1,486
# -*- coding: utf-8 -*- """ this is a place where we put datastructures used by legacy apis we hope ot remove """ import keyword import attr from _pytest.config import UsageError @attr.s class MarkMapping(object): """Provides a local mapping for markers where item access resolves to True if the marker is pr...
cloudera/hue
desktop/core/ext-py/pytest-4.6.11/src/_pytest/mark/legacy.py
Python
apache-2.0
3,287
# Create your views here. import json import os from django.http.response import HttpResponse, Http404 from django.shortcuts import render_to_response from django.template import RequestContext from django.views.decorators.csrf import csrf_exempt from djangogroovedown.utils import download_music_temp_file, search_for_m...
alexandreferreira/groovedowndl
djangogroovedown/servicos/views.py
Python
apache-2.0
2,206
# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # # The *_FORMAT strings use the Django date format syntax, # see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date DATE_FORMAT = 'j F Y' # '20 januari 2009' TIME_FORMAT = 'H:i' ...
rimbalinux/MSISDNArea
django/conf/locale/nl/formats.py
Python
bsd-3-clause
3,109
''' HTML error handling and refactoring routines. ''' __all__ = ['HtmlForm'] from tag import * AUTOCLOSE_TAGS = ['meta', 'link', 'img', 'a', 'br', 'input'] TABLE_CONTENT_TAGS = ['tr', 'tbody', 'thead', 'tfoot', 'colgroup'] TABLE_CELLS = ['td', 'th'] class HtmlForm(object): ''' Handles HTML errors...
AlexPereverzyev/spidy
spidy/document/html_form.py
Python
bsd-3-clause
8,571
# Copyright 2008 The Tor Project, Inc. See LICENSE for licensing information. # Copyright 2010 The Update Framework. See LICENSE for licensing information. import httplib import sys import urllib2 import tuf.hash import tuf.log import tuf.util logger = tuf.log.get_logger() class BaseDownloadJob(object): """A...
sburnett/seattle
tuf/download.py
Python
mit
5,698
#!/usr/bin/env python from __future__ import print_function import os import sys if len(sys.argv) != 2: print("Usage: %s file.cl" % sys.argv[0]) sys.exit(1) # Search for lines that look like #include "blah.h" and replace them # with the contents of blah.h. def do_includes (source): result = list() for line i...
OpenCL/GEGL-OpenCL
opencl/cltostring.py
Python
gpl-3.0
1,657
from django.conf.urls import url from . import views urlpatterns = [ url(r'^$', views.promo, name='promo'), url(r'^login/([0-9]*)', views.login, name='promo'), url(r'^editor/', views.editor, name='editor'), url(r'^weeks/([0-9]{0,2})', views.schedule, name='schedule'), url(r'^help/', views.help, na...
alexey109/botpage.ru
frontend/urls.py
Python
gpl-3.0
401
TAINTED_STRING = "TAINTED_STRING" TAINTED_BYTES = b"TAINTED_BYTES" TAINTED_LIST = ["tainted-{}".format(i) for i in range(5)] TAINTED_DICT = {"name": TAINTED_STRING, "some key": "foo"} NOT_TAINTED = "NOT_TAINTED" # Use this to force expressions to be tainted def taint(*args): pass def ensure_tainted(*args): ...
github/codeql
python/ql/test/experimental/dataflow/tainttracking/taintlib.py
Python
mit
573
# Copyright (c) 2011, Damian Moore # see LICENSE file for license details
damianmoore/django-html5-boilerplate
django-html5-boilerplate/__init__.py
Python
bsd-2-clause
75
import asyncio, socket, time def send_packet(data, sock): sock.send(data) sock.send(b"$PACKET_END$") def recv_packet(sock): data = b"" while b"$PACKET_END$" not in data: d = sock.recv(1) data += d data = data.replace(b"$PACKET_END$", b"") return data de...
123jrf/StarHash
packet.py
Python
mit
963
from typing import Tuple import numpy as np from sklearn import datasets from sklearn.model_selection import train_test_split from decision_trees.datasets.dataset_base import DatasetBase class BostonRaw(DatasetBase): def __init__(self): pass def load_data(self) -> Tuple[np.ndarray, np.ndarray, np.n...
Michal-Fularz/decision_tree
decision_trees/datasets/boston_house_prices_raw.py
Python
mit
2,017
#!/usr/bin/env python3 # Copyright (c) 2020 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test GETDATA processing behavior""" from collections import defaultdict from test_framework.messages import...
syscoin/syscoin
test/functional/p2p_getdata.py
Python
mit
1,660
from __future__ import (absolute_import, division, print_function, unicode_literals) import six # needed for API from .core import DatumNotFound from .handlers_base import HandlerBase, DuplicateHandler from filestore.api import (handler_context, register_handler, de...
NSLS-II/filestore
filestore/retrieve.py
Python
bsd-3-clause
481
from unit_test_common import execute_csv2_request, initialize_csv2_request, ut_id, sanity_requests from sys import argv # lno: CV - error code identifier. def main(gvar): if not gvar: gvar = {} if len(argv) > 1: initialize_csv2_request(gvar, selections=argv[1]) else: ...
hep-gc/cloudscheduler
unit_tests/test_cloud_metadata_list.py
Python
apache-2.0
1,282
import unittest import os.path from wikimap import data class TestInfoboxData(unittest.TestCase): def setUp(self): self.fake_data = {"settlement": 354090.0, "person": 146915.0, "album": 122492.0, "football-biography": 118713.0,...
michaelsilver/wikimap
tests/test_data.py
Python
mit
1,387
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright (C) 2018 David Arroyo Menéndez # Author: David Arroyo Menéndez <davidam@gnu.org> # Maintainer: David Arroyo Menéndez <davidam@gnu.org> # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as p...
davidam/python-examples
matplotlib/plot_3D.py
Python
gpl-3.0
2,145
#!/usr/bin/env python __license__ = 'GPL v3' __copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net' __docformat__ = 'restructuredtext en' ''' Miscelleaneous utilities. '''
yeyanchao/calibre
src/calibre/utils/__init__.py
Python
gpl-3.0
179
from django.contrib.auth.models import User from django.core.urlresolvers import reverse from django.db import models class Location(models.Model): address = models.CharField(blank=True) latitude = models.DecimalField(max_digits=10, decimal_places=6) longitude = models.DecimalField(max_digits=10, decimal_...
derrickyoo/serve-tucson
serve_tucson/locations/models.py
Python
bsd-3-clause
956
import os import unittest import shutil import test.lib.test_helper as test_helper from test.lib.test_helper import MavensMateTest base_test_directory = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) class ProjectCreateTest(MavensMateTest): def test_01_should_create_new_project(self): ...
joeferraro/mm
test/functional/project/project_create_tests.py
Python
gpl-2.0
9,396
# -*- coding: utf-8 -*- """ *************************************************************************** wrappers.py - Standard parameters widget wrappers --------------------- Date : May 2016 Copyright : (C) 2016 by Arnaud Morvan, Victor Olaya Email : arnau...
vmora/QGIS
python/plugins/processing/gui/wrappers.py
Python
gpl-2.0
80,051
class Bunch(dict): """A dict with attribute-access""" def __getattr__(self, key): try: return self.__getitem__(key) except KeyError: raise AttributeError(key) def __setattr__(self, key, value): self.__setitem__(key, value) def __dir__(self): ret...
ellisonbg/ipyleaflet
ipyleaflet/basemaps.py
Python
mit
14,548
# Copyright (c) 2009 CSIRO # Australia Telescope National Facility (ATNF) # Commonwealth Scientific and Industrial Research Organisation (CSIRO) # PO Box 76, Epping NSW 1710, Australia # atnf-enquiries@csiro.au # # This file is part of the ASKAP software distribution. # # The ASKAP software distribution is free softwar...
ATNF/askapsdp
Tools/scons_tools/functestbuilder.py
Python
gpl-2.0
3,116
__license__ = 'GPL v3' __copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>' ''' Miscellaneous widgets used in the GUI ''' import re, os from PyQt5.Qt import (QIcon, QFont, QLabel, QListWidget, QAction, QListWidgetItem, QTextCharFormat, QApplication, QSyntaxHighlighter, QCursor, QColor, QWidg...
ashang/calibre
src/calibre/gui2/widgets.py
Python
gpl-3.0
39,229
import unittest from grade_school import School # Tests adapted from `problem-specifications//canonical-data.json` @ v1.0.0 class GradeSchoolTest(unittest.TestCase): def test_adding_a_student_adds_them_to_the_sorted_roster(self): school = School() school.add_student(name="Aimee", grade=2) ...
smalley/python
exercises/grade-school/grade_school_test.py
Python
mit
2,435
from .const import Status from .exceptions import GRPCError __version__ = '0.4.3rc2' __all__ = ( 'Status', 'GRPCError', )
vmagamedov/grpclib
grpclib/__init__.py
Python
bsd-3-clause
132
############################################################################### # Copyright 2006 to the present, Orbitz Worldwide, 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...
OrbitzWorldwide/droned
droned/lib/droned/clients/blaster.py
Python
apache-2.0
12,134
# -*- coding: utf-8 -*- """ Created on Tue Dec 6 15:50:15 2016 @author: Louis """ import math def amagnitude(components): """ This function calculates the magnitude of the acceleration. """ return int(math.sqrt(components[0]**2 + components[1]**2 + components[2]**2)) #def asample(imu...
Kaiapuni/ME-507-Project
imumath.py
Python
gpl-3.0
695
## # Copyright 2013 Dmitri Gribenko # # This file is triple-licensed under GPLv2 (see below), MIT, and # BSD three-clause licenses. # # 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 Flemi...
ULHPC/modules
easybuild/easybuild-easyblocks/easybuild/easyblocks/c/clang.py
Python
mit
16,924
from memcached_clients import RestclientPymemcacheClient import re ONE_MINUTE = 60 ONE_HOUR = 60 * 60 class RestClientsCache(RestclientPymemcacheClient): """ A custom cache implementation for Course Dashboards """ def get_cache_expiration_time(self, service, url, status=200): if "sws" == service: ...
uw-it-aca/course-dashboards
coursedashboards/cache.py
Python
apache-2.0
815
# coding: utf-8 """ ORCID Member No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 OpenAPI spec version: Latest Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint import re # noqa: F401 import si...
Royal-Society-of-New-Zealand/NZ-ORCID-Hub
orcid_api_v3/models/affiliation_group_v30_rc1_education_summary_v30_rc1.py
Python
mit
5,691
from __future__ import with_statement from alembic import context from sqlalchemy import engine_from_config, pool from logging.config import fileConfig # this is the Alembic Config object, which provides # access to the values within the .ini file in use. config = context.config # Interpret the config file for Python...
PuZheng/lejian-backend
alembic/env.py
Python
mit
2,064
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import datetime from django.utils.timezone import utc class Migration(migrations.Migration): dependencies = [ ('bulk', '0006_auto_20150302_1750'), ] operations = [ migrations.AlterFi...
Sult/daf
apps/bulk/migrations/0007_auto_20150302_1935.py
Python
mit
563
import general_exceptions try: import cPickle as pickle except: import pickle def get_application_settings(application_name, redis): # TODO: Add settings validation if not application_name: raise general_exceptions.Register_NoApplicationName('Can\'t set application settin...
stoneworksolutions/redongo
redongo/utils.py
Python
mit
1,420
from http.server import BaseHTTPRequestHandler from urllib.parse import urlparse, parse_qs import json class webhookReceiver(BaseHTTPRequestHandler): _bot = None def _handle_incoming(self, path, query_string, payload): """gitlab-specific handling""" try: object_kind = payload["obj...
ravrahn/HangoutsBot
hangupsbot/sinks/gitlab/simplepush.py
Python
gpl-3.0
2,313
import logging import math from six.moves import StringIO from .. import planning, config from ..job import Job from ..action import PenUpMove, PenDownMove, XYMove from . import handlers from .state import State log = logging.getLogger(__name__) def estimate_time(actions): return sum(action.time() for action ...
storborg/axibot
axibot/server/plotting.py
Python
gpl-2.0
6,534
import os from expects import expect, contain, have_keys from mamba import before, description, it from sdcclient import SdScanningClient from specs import be_successful_api_call with description("Scanning list_image_tags") as self: with before.all: self.client = SdScanningClient(sdc_url=os.getenv("SDC_S...
draios/python-sdc-client
specs/secure/scanning/list_image_tags_spec.py
Python
mit
802
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: t -*- # vi: set ft=python sts=4 ts=4 sw=4 noet : # This file is part of Fail2Ban. # # Fail2Ban 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;...
linux-modder/Fedora-Respins-SOPs
confs/fail2ban/action.d/badips.py
Python
gpl-3.0
10,658
from __future__ import print_function, absolute_import import re import logging import numpy as np from ...utils import int_else_float_except_string logging.basicConfig() logger = logging.getLogger(__file__) def find_name(string): return re.search('function\s*mpc\s*=\s*(?P<data>.*?)\n', string).groupdict()['d...
kdheepak/psst
psst/case/matpower/reader.py
Python
mit
1,747
""" Support for IP Webcam, an Android app that acts as a full-featured webcam. For more details about this component, please refer to the documentation at https://home-assistant.io/components/android_ip_webcam/ """ import asyncio import logging from datetime import timedelta import voluptuous as vol from homeassista...
morphis/home-assistant
homeassistant/components/android_ip_webcam.py
Python
apache-2.0
10,232
""" =========================================== Main Components (:mod:`artview.components`) =========================================== .. currentmodule:: artview.components ARTview offers some basic Components for visualization of weather radar data using Py-ART and ARTview functions. .. autosummary:: :toctree:...
jjhelmus/artview
artview/components/__init__.py
Python
bsd-3-clause
1,065
# -*- coding: utf-8 -*- # Copyright (c) 2015, ESS LLP and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe from frappe import _ from frappe.model.document import Document from frappe.utils import cint, cstr, getdate, flt import dateutil from frappe.mo...
ebukoz/thrive
erpnext/healthcare/doctype/patient/patient.py
Python
gpl-3.0
4,604
import rose.upgrade class vn40_vn41(rose.upgrade.MacroUpgrade): """Version bump macro""" BEFORE_TAG = "vn4.0" AFTER_TAG = "vn4.1" def upgrade(self, config, meta_config=None): # Nothing to do return config, self.reports class vn41_vn42(rose.upgrade.MacroUpgrade): """Vers...
braghiere/JULESv4.6_clump
rose-meta/jules-fcm-make/versions.py
Python
gpl-2.0
3,548
withdraw_amount,bank_balance = raw_input().split() bank_transaction_charge = float(0.50) withdraw_amount = int(withdraw_amount) bank_balance = float(bank_balance) debit_amount = withdraw_amount + bank_transaction_charge if withdraw_amount%5==0 and debit_amount<=bank_balance: bank_balance -= debit_amount print ("...
sandy-8925/codechef
hs08test.py
Python
mit
341