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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
import re
from pupa.scrape import Scraper, Organization
from openstates.utils import LXMLMixin
class PRCommitteeScraper(Scraper, LXMLMixin):
def _match_title(self, member):
# Regexes should capture both gendered forms.
title_regex = {
"chairman": r", President.*... | openstates/openstates | openstates/pr/committees.py | Python | gpl-3.0 | 4,541 |
import os
import pprint
from numpy import linspace
from numpy.ma import MaskedArray
from netCDF4 import Dataset
from dilegeometry import DileGeometry
class Dile(DileGeometry):
def __init__(self, z=0, y=0, x=0, variable=None, attributes=None):
self.variable = variable
self.attributes = attributes... | RDCEP/hybrid-dile-server | lib/diles/dile.py | Python | apache-2.0 | 2,305 |
import logging
import os
import pkg_resources
from mako.lookup import TemplateLookup
import ringo.lib.helpers
from ringo.lib.helpers import (
get_saved_searches,
get_item_actions,
literal,
get_action_routename
)
from ringo.lib.table import get_table_config
import ringo.lib.security as security
base_dir... | ringo-framework/ringo | ringo/lib/renderer/lists.py | Python | gpl-2.0 | 7,392 |
from twisted.internet import reactor
from twisted.web import proxy, http
class ProxyRequest(proxy.ProxyRequest):
def process(self):
self.requestHeaders.addRawHeader(b'aproxy', b'yes')
try:
proxy.ProxyRequest.process(self)
except KeyError:
pass
class Proxy(proxy.Pr... | TeamHG-Memex/autologin | tests/proxy.py | Python | apache-2.0 | 815 |
#! /usr/bin/env python
#
import re, sys
_exr = re.compile ('(\s*)(\S+)\s(.*\S)(.*)')
def main ():
in_code = False
for l in sys.stdin.readlines ():
while l[-1:] in ['\r', '\n']: l = l[:-1]
if l in ['prefix', 'postfix']: continue
if not in_code and l[:5] == 'code ':
in_code ... | samueltardieu/rforth1 | utils/pretopost.py | Python | gpl-2.0 | 848 |
##########################################################################
#
# Copyright (c) 2016, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistrib... | chippey/gaffer | python/GafferSceneUI/LightToCameraUI.py | Python | bsd-3-clause | 2,226 |
#!/usr/bin/python
import sys
import subprocess
import string
from StringIO import StringIO
from xml.dom.minidom import parseString, parse
from string import strip
#----- Extraction of the tracker results
class TestResult(object):
__slots__ = [
'test',
'descrip... | dudochkin-victor/libqttracker | tests/benchmarking/mergeresults.py | Python | lgpl-2.1 | 6,870 |
from __future__ import absolute_import
import logging
import six
import pandas as pd
import numpy as np
from ..plotting import curdoc
from ..models import ColumnDataSource, GridPlot, Panel, Tabs, Range
from ..models.widgets import Select, MultiSelect, InputWidget
# crossfilter plotting utilities
from .plotting impo... | lukebarnard1/bokeh | bokeh/crossfilter/models.py | Python | bsd-3-clause | 30,379 |
import json
import logging
from requests.exceptions import ConnectionError
import time
from matrix_client.client import MatrixClient
from matrix_client.errors import MatrixRequestError
from .. import settings
from . import command, exceptions
from .op import op, OPExecutor
from .room_event import RoomEventObserver
fr... | simonklb/matrix-leaf | leaf/client/client.py | Python | mit | 11,707 |
#!/usr/bin/env python
from utils import *
def test_abusive_sergeant():
game = prepare_game()
wisp = game.player1.give(WISP)
wisp.play()
assert wisp.atk == 1
game.player1.give("CS2_188").play(target=wisp)
assert wisp.atk == 3
game.end_turn()
assert wisp.atk == 1
def test_acolyte_of_pain():
game = prepare_ga... | NightKev/fireplace | tests/test_classic.py | Python | agpl-3.0 | 94,433 |
tag_to_db_map = {
"artist": "artist_name",
"album": "album_name",
"title": "title",
"date": "year",
"discyear": "year",
"tracknumber": "track",
"discnumber": "discnumber"
}
| bmillham/DJDB | SimpleTag/map.py | Python | gpl-2.0 | 309 |
# Copyright (C) 2011 Jason Anderson
#
#
# This file is part of PseudoTV.
#
# PseudoTV 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.... | jtucker1972/XBMC-TVTime | resources/lib/parsers/AVIParser.py | Python | gpl-3.0 | 6,943 |
__author__ = 'bromix'
from six.moves import urllib
import re
from ...kodion.items import VideoItem, DirectoryItem
from . import utils
class UrlToItemConverter(object):
RE_CHANNEL_ID = re.compile(r'^/channel/(?P<channel_id>.+)$')
def __init__(self, flatten=True):
self._flatten = flatten
sel... | Etharr/plugin.video.youtube | resources/lib/youtube_plugin/youtube/helper/url_to_item_converter.py | Python | gpl-2.0 | 6,240 |
keyboard.send_key("<right>")
| yutakatay/dotfiles | .config/autokey/alt-l.py | Python | mit | 29 |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.contrib.auth.models import AnonymousUser
from chisch.common.retwrapper import RetWrapper
from chisch.common import dependency
@dependency.requires('auth_manager')
class AuthenticationMiddleware(object):
def _recognise_access_token(self, reque... | zhaowenxiang/chisch | chisch/middleware/authenticate.py | Python | mit | 1,163 |
class Solution(object):
def generateMatrix(self, n):
if n == 0:
return []
if n == 1:
return [[1]]
matrix = [[-1 for x in range(n)] for y in range(n)]
direction = right
current = 2
pos_x = 0
pos_y = 0
matrix[0][0] = 1
wh... | luosch/leetcode | python/Spiral Matrix II.py | Python | mit | 1,483 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
REGIONS = (
('us-east-1', 'US East (N. Virginia)'),
('us-west-1', 'US West (N. California)'),
('us-west-2', 'US West (Oregon)'),
('ap-northeast-1', 'Asia Pacific (Tokyo)'),
('ap-southeast-1', ... | crccheck/django-aws-admin | aws_admin/migrations/0002_initial_data_regions.py | Python | apache-2.0 | 883 |
#
# 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/fate_arch/session/_parties.py | Python | apache-2.0 | 2,612 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from StringIO import StringIO
from twisted.internet.protocol import Protocol, Factory
from twisted.trial import unittest
from twisted.web.test.test_web import DummyRequest
from twisted.test.proto_helpers import StringTransport
from twisted.internet.defer import succeed
fro... | INTERACT-IV/sockjs-twisted | txsockjs/tests/common.py | Python | bsd-3-clause | 2,045 |
# -*- coding: utf-8 -*-
#
# This file is part of INSPIRE.
# Copyright (C) 2014-2017 CERN.
#
# INSPIRE 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 ... | kaplun/inspire-next | inspirehep/modules/hal/core/tei.py | Python | gpl-3.0 | 5,212 |
from couchpotato.core.helpers.encoding import toUnicode
from elixir.entity import Entity
from elixir.fields import Field
from elixir.options import options_defaults, using_options
from elixir.relationships import ManyToMany, OneToMany, ManyToOne
from sqlalchemy.types import Integer, Unicode, UnicodeText, Boolean, Strin... | cloakedcode/CouchPotatoServer | couchpotato/core/settings/model.py | Python | gpl-3.0 | 7,477 |
import os
import os.path
import mimetypes
from wikid import build
from wikid.convert import convert
class WikidNotFoundError(Exception):
pass
class WikidApp(object):
def __init__(self, path, port):
self.path = path
self.port = port
self.paths = [
path,
os... | elishacook/wikid | wikid/wsgi.py | Python | mit | 4,060 |
#!/usr/bin/env python
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# 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 us... | EmanueleCannizzaro/scons | test/Interactive/cache-debug.py | Python | mit | 3,156 |
# 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 agreed to in writing, software
#... | vishnu-kumar/PeformanceFramework | rally_os/plugins/aws/scenarios/ec2/utils.py | Python | apache-2.0 | 3,015 |
# Copyright (c) 2014 The Johns Hopkins University/Applied Physics Laboratory
# 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/LICEN... | callidus/PyKMIP | kmip/tests/unit/core/factories/payloads/test_request.py | Python | apache-2.0 | 6,504 |
import numpy as np
from .VariableUnitTest import VariableUnitTest
from gwlfe.Input.Animals import AEU
class TestAEU(VariableUnitTest):
def test_AEU(self):
z = self.z
np.testing.assert_array_almost_equal(
AEU.AEU_f(z.NumAnimals, z.AvgAnimalWt, z.Area),
AEU.AEU(z.NumAnimals... | WikiWatershed/gwlf-e | test/unittests/test_AEU.py | Python | apache-2.0 | 373 |
# coding: utf-8
"""
DocuSign REST API
The DocuSign REST API provides you with a powerful, convenient, and simple Web services API for interacting with DocuSign. # noqa: E501
OpenAPI spec version: v2.1
Contact: devcenter@docusign.com
Generated by: https://github.com/swagger-api/swagger-codegen.gi... | docusign/docusign-python-client | docusign_esign/apis/cloud_storage_api.py | Python | mit | 51,067 |
from six import with_metaclass
from abc import ABCMeta, abstractmethod
from frappe.utils.password import get_decrypted_password
class BaseConnection(with_metaclass(ABCMeta)):
@abstractmethod
def get(self, remote_objectname, fields=None, filters=None, start=0, page_length=10, parent=None):
pass
@abstractmethod
... | paurosello/frappe | frappe/data_migration/doctype/data_migration_connector/connectors/base.py | Python | mit | 604 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
[path]
cd /Users/brunoflaven/Documents/01_work/blog_articles/extending_streamlit_usage/streamlit_design/
[file]
streamlit run streamlit_design_5.py
# source
https://github.com/Jcharis/Streamlit_DataScience_Apps/blob/master/Streamlit_Python_Crash_Course/docs_app.py
... | bflaven/BlogArticlesExamples | extending_streamlit_usage/010_streamlit_design/streamlit_design_5.py | Python | mit | 6,097 |
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2014 Thomas Voegtlin
#
# 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 y... | akshayaurora/electrum | lib/paymentrequest.py | Python | gpl-3.0 | 15,045 |
#!/usr/bin/python
#
# Urwid html fragment output wrapper for "screen shots"
# Copyright (C) 2004-2007 Ian Ward
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# v... | suizokukan/urwid | urwid/html_fragment.py | Python | lgpl-2.1 | 8,175 |
from django.test.testcases import TestCase
from django.test.utils import override_settings
from geotrek.feedback.factories import ReportFactory
class TestFeedbackModel(TestCase):
def setUp(self):
self.report = ReportFactory(email="mail@mail.fr")
def test_get_display_name(self):
s = f'<a data... | makinacorpus/Geotrek | geotrek/feedback/tests/test_models.py | Python | bsd-2-clause | 672 |
"""
Smoke test all the major ElasticScatter methods
"""
from __future__ import print_function
from pyiid.tests import *
from pyiid.experiments.elasticscatter import ElasticScatter
import inspect
__author__ = 'christopher'
# ----------------------------------------------------------------------------
def check_method... | CJ-Wright/pyIID | pyiid/tests/test_scatter_smoke.py | Python | bsd-3-clause | 2,612 |
from dynaconf import Dynaconf
settings = Dynaconf(load_dotenv=True)
assert settings.get("UPSTREAM_ROOK.BUILD_ROOK_FROM_GIT") == "TRUE"
assert (
settings.as_bool("UPSTREAM_ROOK.BUILD_ROOK_FROM_GIT") is True
), settings.as_bool("UPSTREAM_ROOK.BUILD_ROOK_FROM_GIT")
assert settings.get("UPSTREAM_ROOK__BUILD_ROOK_FR... | rochacbruno/dynaconf | example/issues/445_casting/app.py | Python | mit | 351 |
"""Serializer tests for the Dropbox addon."""
import pytest
from tests.base import OsfTestCase
from addons.dropbox.serializer import DropboxSerializer
from addons.base.tests.serializers import StorageAddonSerializerTestSuiteMixin
from addons.dropbox.tests.factories import DropboxAccountFactory
from addons.dropbox.te... | mluo613/osf.io | addons/dropbox/tests/test_serializers.py | Python | apache-2.0 | 718 |
class Error(Exception):
pass
class ClientError(Error):
pass
class ServerError(Error):
pass
class AuthenticationError(ClientError):
pass
| Nexmo/nexmo-python | src/nexmo/errors.py | Python | mit | 158 |
"""Tools for manipulating of large commutative expressions. """
from __future__ import print_function, division
from sympy.core.add import Add
from sympy.core.compatibility import iterable, is_sequence, SYMPY_INTS, range
from sympy.core.mul import Mul, _keep_coeff
from sympy.core.power import Pow
from sympy.core.basi... | vipulroxx/sympy | sympy/core/exprtools.py | Python | bsd-3-clause | 48,349 |
# -*- coding: utf-8 -*-
# Copyright(C) 2012 Romain Bignon
#
# This file is part of a weboob module.
#
# This weboob module 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 Licens... | vicnet/weboob | modules/seloger/browser.py | Python | lgpl-3.0 | 2,990 |
#!/usr/bin/env python3
__copyright__ = 'Copyright (c) 2021, Utrecht University'
__license__ = 'GPLv3, see LICENSE'
from flask import Blueprint, render_template
datarequest_bp = Blueprint(
'datarequest_bp',
__name__,
template_folder='templates'
)
@datarequest_bp.route('/example')
def index():
retu... | UtrechtUniversity/yoda-portal | datarequest/datarequest.py | Python | gpl-3.0 | 367 |
#!/user/bin/env python
# coding=utf-8
__author__ = 'xzhao'
import RPi.GPIO as GPIO
import time
import threading
GPIO.setmode(GPIO.BOARD)
GPIO_shock = 12 # 振动传感器GPIO
shock = 0
shocki = 0
shockSum = 0
previousShock = 0 #Shock前一个状态
GPIO.setup(GPIO_shock, GPIO.IN)
def signalCollect():
while True:
signalshoc... | xiaokaizh/SmartDoorControl | ShockTest.py | Python | apache-2.0 | 1,145 |
from backend.stage import ready_stage
from backend import message
from backend import helpers
class JobStage(ready_stage.ReadyStage):
stage_type = 'Job'
def __init__(self, game) -> None:
super().__init__(game)
self._job_selected = {} # facility selected indexed by player
@classmethod
... | iteloo/the_island | backend/stage/job_stage.py | Python | mit | 2,659 |
import datetime
metadata = dict(
name='Missouri',
abbreviation='mo',
legislature_name='Missouri General Assembly',
legislature_url='http://www.moga.mo.gov/',
capitol_timezone='America/Chicago',
chambers={
'upper': {
'name': 'Senate',
'title': 'Senator'
},... | votervoice/openstates | billy_metadata/mo.py | Python | gpl-3.0 | 4,601 |
def arrayWithIndFibSeqNum(num):
a = 0
b = 1
seq = []
seq.append(a)
seq.append(b)
num = num-2
while num != 0:
temp = a
a = b
b = a + temp
if b < 10:
seq.append(b)
else:
temp = b
newSeq = []
while temp != 0:
newSeq.append(temp%10)
temp = temp/10
while len(newSeq) > 0:
seq.app... | ruchikd/Algorithms | Python/StoreFibSeqInArray/StoreFibSeqInArray.py | Python | gpl-3.0 | 753 |
__author__ = 'mpetyx'
import xlrd
import csv
import json
def csv_from_excel():
wb = xlrd.open_workbook('SampleData.xls')
names = wb.sheet_names()
sh = wb.sheet_by_name(names[0])
your_csv_file = open('your_csv_file.csv', 'wb')
wr = csv.writer(your_csv_file, quoting=csv.QUOTE_ALL)
for rownum i... | Suite5/DataColibri | engage/jsonHandler/ExceltoCsv.py | Python | mit | 1,097 |
from django.apps import AppConfig
class WMExtraConfig(AppConfig):
name = 'geonode.contrib.worldmap.wm_extra'
verbose_name = 'WM Extras'
def ready(self):
from geonode.contrib.worldmap.wm_extra import signals # noqa
| MapStory/geonode | geonode/contrib/worldmap/wm_extra/apps.py | Python | gpl-3.0 | 237 |
import pickle
import toml
from toml.decoder import InlineTableDict
from ai.backend.common.config import override_key, merge, _sanitize_inline_dicts
def test_override_key():
sample = {
'a': {
'b': 0,
},
'c': 1,
}
override_key(sample, ('a', 'b'), -1)
assert sample['... | lablup/sorna-common | tests/test_config.py | Python | lgpl-3.0 | 2,144 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your o... | kustodian/ansible | lib/ansible/modules/network/check_point/cp_mgmt_application_site_category.py | Python | gpl-3.0 | 5,115 |
import unittest
import os
import sys
import numpy as np
from ifcb.data import files
from .fileset_info import TEST_FILES, data_dir, WHITELIST, list_test_filesets, list_test_bins
class TestListUtils(unittest.TestCase):
def setUp(self):
self.data_dir = data_dir()
def test_list_data_dirs(self):
... | joefutrelle/pyifcb | ifcb/tests/data/test_files.py | Python | mit | 6,620 |
from django.test import TestCase
from django.test.client import Client
from django.contrib.auth.models import User
from django_comment_common.models import (
Role, FORUM_ROLE_ADMINISTRATOR, FORUM_ROLE_MODERATOR, FORUM_ROLE_STUDENT)
from django_comment_common.utils import seed_permissions_roles
from student.models i... | mtlchun/edx | common/djangoapps/student/tests/test_auto_auth.py | Python | agpl-3.0 | 7,470 |
##
# This module implements a general-purpose server layer for sfa.
# The same basic server should be usable on the registry, component, or
# other interfaces.
#
# TODO: investigate ways to combine this with existing PLC server?
##
import threading
from sfa.server.threadedserver import ThreadedServer, SecureXMLRpcReq... | yippeecw/sfa | sfa/server/sfaserver.py | Python | mit | 2,189 |
from ddapp.tasks.robottasks import *
from ddapp.tasks.descriptions import loadTaskDescription
import ddapp.applogic as app
def _splitCamelCase(name):
name = re.sub('(.)([A-Z][a-z]+)', r'\1 \2', name)
return re.sub('([a-z0-9])([A-Z])', r'\1 \2', name)
class TaskItem(om.ObjectModelItem):
def __init__(sel... | edowson/director | src/python/ddapp/tasks/taskmanagerwidget.py | Python | bsd-3-clause | 13,144 |
from ..broker import Broker
class SubnetBroker(Broker):
controller = "subnets"
def show(self, **kwargs):
"""Shows the details for the specified subnet.
**Inputs**
| ``api version min:`` None
| ``api version max:`` None
| ``required:`` True
... | infobloxopen/infoblox-netmri | infoblox_netmri/api/broker/v3_8_0/subnet_broker.py | Python | apache-2.0 | 68,120 |
from servicebase import ServiceBase
from servicefield import ServiceField
from django import forms
from sh import ErrorReturnCode
from updatefunctions import updateStateField
from sh import chpasswd, usermod, useradd, chown
from users.models import Service
from django.contrib import messages
STATES = (
('d', 'disa... | aarne-kyppo/bachelorthesis | users/serviceclasses/localaccount.py | Python | mit | 4,053 |
#!/usr/bin/env python
""" MultiQC module to parse output from Lima """
from collections import OrderedDict
import logging
import re
from multiqc import config
from multiqc.modules.base_module import BaseMultiqcModule
from multiqc.plots import bargraph, table
# Initialise the logger
log = logging.getLogger(__name__)... | ewels/MultiQC | multiqc/modules/lima/lima.py | Python | gpl-3.0 | 13,554 |
# coding: utf-8
#
# Copyright 2014 The Oppia 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 requi... | terrameijar/oppia | core/domain/stats_jobs_continuous_test.py | Python | apache-2.0 | 39,399 |
from .algebra import Set, Integers
| pearu/sympycore | sympycore/sets/__init__.py | Python | bsd-3-clause | 36 |
# SPDX-License-Identifier: MIT
| python-attrs/attrs | tests/__init__.py | Python | mit | 31 |
from __future__ import unicode_literals, print_function
from jsontowidget import widget_from_json
class Survey(object):
def __init__(self, json_survey, **kwargs):
super(Survey, self).__init__(**kwargs)
self.survey_file = json_survey
self.questionnaires = {}
self.prev_questionnaires... | Kovak/KivySurvey | kivy_survey/survey.py | Python | mit | 5,884 |
from numpy import *
from skimage.measure import find_contours
from scipy import misc
from scipy.ndimage.filters import gaussian_filter
from scipy.interpolate import interp1d
from ..manifolds.curves import Curve
def arclength_param(line) :
vel = line[1:, :] - line[:-1, :]
vel = sqrt(sum( vel ** 2, 1 ))
return hsta... | jeanfeydy/lddmm-ot | LDDMM_Python/lddmm_python/modules/io/level_lines.py | Python | mit | 1,478 |
import search
import submissions.Anderson.puzzles as pz
def compare_searchers(problems, header, searchers=[]):
def do(searcher, problem):
p = search.InstrumentedProblem(problem)
goalNode = searcher(p)
return p, goalNode.path_cost
table = [[search.name(s)] + [do(s, p) for p in problems] ... | armadill-odyssey/aima-python | submissions/Anderson/runPuzzles.py | Python | mit | 633 |
from cwbot.modules.BaseDungeonModule import BaseDungeonModule, eventDbMatch
def killPercent(n):
return int(max(0, min(99, 100*n / 500.0)))
def getTireDamage(n):
return int(round(0.1*n*n + 0.7*n))
UNKNOWN = 0
GUESSED = 1
KNOWN = 2
class BurnbarrelModule(BaseDungeonModule):
"""
A ... | ijzer/cwbot-ndy | cwbot/modules/hobopolis/BurnbarrelModule.py | Python | bsd-3-clause | 14,141 |
"""HMAC (Keyed-Hashing for Message Authentication) Python module.
Implements the HMAC algorithm as described by RFC 2104.
"""
import warnings as _warnings
from _operator import _compare_digest as compare_digest
import hashlib as _hashlib
trans_5C = bytes((x ^ 0x5C) for x in range(256))
trans_36 = bytes((x ^ 0x36) fo... | momm3/WelcomeBot | welcomebot/Lib/hmac.py | Python | mit | 5,057 |
'''
Defines the link functions to be used with GLM and GEE families.
'''
import numpy as np
import scipy.stats
FLOAT_EPS = np.finfo(float).eps
class Link(object):
"""
A generic link function for one-parameter exponential family.
`Link` does nothing, but lays out the methods expected of any subclass.
... | bert9bert/statsmodels | statsmodels/genmod/families/links.py | Python | bsd-3-clause | 20,469 |
import json
import codecs
import requests
import itertools
URL_MAIN = "http://api.nytimes.com/svc/"
URL_POPULAR = URL_MAIN + "mostpopular/v2/"
API_KEY = { "popular": "",
"article": ""}
def get_from_file(kind, period):
filename = "popular-{0}-{1}.json".format(kind, period)
with open(filename, "r")... | eneskemalergin/MongoDB | Lesson1/Problem Set/problem3.py | Python | mit | 3,364 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2015 Cristian van Ee <cristian at cvee.org>
# Copyright 2015 Igor Gnatenko <i.gnatenko.brain@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as pu... | marcosdiez/ansible-modules-extras | packaging/os/dnf.py | Python | gpl-3.0 | 11,744 |
import numpy as np
from Airfoil import *
def get_nrel_stations():
''' Reference: NREL/TP-500-29955 (2001)
Data has been extrapolated to root for smoothness'''
r_R = np.array([1.988466892027e-01,
2.246967587990e-01,
2.493218333665e-01,
2.697045337045e-01,
2.887492742096e-... | aniketaranake/xrotorWT | xrotorWT/xrotorWT.py | Python | gpl-2.0 | 2,903 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.tests import common
class TestWorkOrderProcess(common.TransactionCase):
def setUp(self):
super(TestWorkOrderProcess, self).setUp()
self.source_location_id = self.ref('stock.stock_location... | richard-willowit/odoo | addons/mrp/tests/test_workorder_operation.py | Python | gpl-3.0 | 21,944 |
#!/usr/bin/python
# 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
# "Licens... | wido/cloudstack | systemvm/debian/opt/cloud/bin/update_config.py | Python | apache-2.0 | 5,009 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import sqlite3 as lite
import config as c
import cherrypy
int_none = None
class Easy:
"""
SQLite class.
"""
def __init__(self):
self._conn = None
connect = None
try:
try:
connect = cherrypy.thread_data.cur... | Aqru/phoenix | sqlite.py | Python | mit | 21,792 |
# -*- coding: utf-8 -*-
"""Tests for certificates views. """
import json
import ddt
import mock
from uuid import uuid4
from nose.plugins.attrib import attr
from mock import patch
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test.client import Client
from django.test.utils ... | ZLLab-Mooc/edx-platform | lms/djangoapps/certificates/tests/test_webview_views.py | Python | agpl-3.0 | 36,025 |
"""HTML form handling for web clients.
ClientForm is a Python module for handling HTML forms on the client
side, useful for parsing HTML forms, filling them in and returning the
completed forms to the server. It has developed from a port of Gisle
Aas' Perl module HTML::Form, from the libwww-perl library, but the
inte... | goofwear/raspberry_pwn | src/pentest/sqlmap/thirdparty/clientform/clientform.py | Python | gpl-3.0 | 126,254 |
import unittest2 as unittest
from nose.plugins.attrib import attr
from mock import MagicMock, patch
import sys
from jnpr.junos.console import Console
if sys.version < '3':
builtin_string = '__builtin__'
else:
builtin_string = 'builtins'
@attr('unit')
class TestSerial(unittest.TestCase):
@patch('jnpr.ju... | pklimai/py-junos-eznc | tests/unit/transport/test_serial.py | Python | apache-2.0 | 2,676 |
from uuid import uuid1
from ..utils import utils
from ..utils.constants import UUID_FIELD_NAME
class JsonSerializable:
readable_names = {}
export_filter_set = {
"mod", # Modification time
"usn", # Todo clarify
"id"
}
import_filter_set = {"__type__"}
def __init__(self):
... | Stvad/CrowdAnki | crowd_anki/representation/json_serializable.py | Python | mit | 4,207 |
import numpy as np
"""
This file implements various first-order update rules that are commonly used for
training neural networks. Each update rule accepts current weights and the
gradient of the loss with respect to those weights and produces the next set of
weights. Each update rule has the same interface:
def updat... | machinelearningnanodegree/stanford-cs231 | solutions/vijendra/assignment2/cs231n/optim.py | Python | mit | 6,338 |
"""Config flow for Fjäråskupan integration."""
from __future__ import annotations
import asyncio
import async_timeout
from bleak import BleakScanner
from bleak.backends.device import BLEDevice
from bleak.backends.scanner import AdvertisementData
from fjaraskupan import UUID_SERVICE, device_filter
from homeassistant.... | jawilson/home-assistant | homeassistant/components/fjaraskupan/config_flow.py | Python | apache-2.0 | 1,097 |
# coding=utf8
# Copyright © 2015-2017 Cask Data, 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 a... | cdapio/cdap-ambari-service | src/main/resources/common-services/CDAP/6.0.0/package/scripts/ambari_helpers.py | Python | apache-2.0 | 4,515 |
#!/usr/bin/env python
from sklearn.datasets import load_files
from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer
from sklearn.naive_bayes import MultinomialNB
from sklearn.linear_model import SGDClassifier
from sklearn.pipeline import Pipeline
from sklearn.grid_search import GridSearchCV
from... | pchaigno/trieur | train.py | Python | mit | 2,460 |
# Copyright 2015 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... | AnishShah/tensorflow | tensorflow/python/training/optimizer.py | Python | apache-2.0 | 49,017 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2021-04-20 18:08
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('servico', '0017_tipoevento_loaddata'),
]
operations = [
migrations.AddFiel... | anselmobd/fo2 | src/servico/migrations/0018_tipoevento_flags.py | Python | mit | 1,269 |
"""
Django settings for mysite project.
Generated by 'django-admin startproject' using Django 1.10.6.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os
... | abhikumar22/MYBLOG | mysite/settings.py | Python | gpl-3.0 | 4,404 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Example program integrating an IVP problem of van der Pol oscillator
"""
from __future__ import (absolute_import, division, print_function)
import numpy as np
from pyodeint import integrate_adaptive, integrate_predefined
def get_f_and_j(mu):
def f(t, y, dydt):... | bjodah/pyodeint | examples/van_der_pol.py | Python | bsd-2-clause | 1,528 |
# -*- 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... | a0c/odoo | addons/account_followup/account_followup.py | Python | agpl-3.0 | 28,535 |
import os
from setuptools import find_packages
from setuptools import setup
import re
VERSIONFILE=os.path.join('traitar', '_version.py')
verstrline = open(VERSIONFILE, "rt").read()
VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]"
mo = re.search(VSRE, verstrline, re.M)
if mo:
verstr = mo.group(1)
else:
raise Runt... | aweimann/traitar | setup.py | Python | gpl-3.0 | 1,138 |
#!/usr/bin/python
# Copyright: Ansible Project
# 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__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... | tareqalayan/ansible | lib/ansible/modules/cloud/amazon/ec2_instance.py | Python | gpl-3.0 | 64,973 |
#!/usr/bin/env python
import subprocess
# Example on how to use this script.
# ./tellWords.py [ and press enter]
# In the prompt line type what you want and press enter again.
command = "say"
text = raw_input("Enter word or a sentence and press enter: ")
characters = list(text)
for c1 in characters:
if c1 == " ... | Amitmund/quick_tools | tellWords/tellWords.py | Python | mit | 438 |
__author__ = "R B Wilkinson"
__date__ = "29/02/12"
__copyright__ = "(C) 2012 Science and Technology Facilities Council"
__license__ = "BSD - see LICENSE file in top-level directory"
__contact__ = "Philip.Kershaw@stfc.ac.uk"
__revision__ = "$Id$"
try:
from setuptools import setup, find_packages
except ImportError:
... | cedadev/ndg_oauth | ndg_oauth_server/setup.py | Python | bsd-3-clause | 3,032 |
# Copyright 2009-2014 Justin Riley
#
# This file is part of TethysCluster.
#
# TethysCluster is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# la... | tethysplatform/TethysCluster | tethyscluster/volume.py | Python | lgpl-3.0 | 15,688 |
# Copyright (C) 2012 Nippon Telegraph and Telephone Corporation.
# Copyright (C) 2012 Isaku Yamahata <yamahata at private email ne jp>
#
# 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
#
# h... | o3project/ryu-oe | ryu/app/wsgi.py | Python | apache-2.0 | 8,391 |
import urllib.request, urllib.error, urllib.parse, urllib.response, urllib.robotparser
import json as j
import sys
__version__ = 0.3
def query(query, useragent='python-duckduckgo '+str(__version__), safesearch=True, html=False, meanings=True, **kwargs):
"""
Query DuckDuckGo, returning a Results object.
... | robbielynch/RoblySearch | duckduckgo/duckduckgo.py | Python | gpl-2.0 | 5,472 |
# Copyright (c) 2012 Adi Roiban.
# See LICENSE for details.
"""
System test running under non-privileged account.
"""
| chevah/utils | chevah/utils/tests/normal/system/__init__.py | Python | bsd-3-clause | 118 |
# Copyright 2015 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 contextlib
import json
from recipe_engine import recipe_api
from recipe_engine import util as recipe_util
class AmpApi(recipe_api.RecipeApi):
def... | eunchong/build | scripts/slave/recipe_modules/amp/api.py | Python | bsd-3-clause | 12,448 |
# -*- coding: utf-8 -*-
"""
.. module:: dj-stripe.contrib.rest_framework.views.
:synopsis: Views for the dj-stripe REST API.
.. moduleauthor:: Philippe Luickx (@philippeluickx)
"""
from __future__ import unicode_literals
from rest_framework import status
from rest_framework.permissions import IsAuthenticated
f... | tkwon/dj-stripe | djstripe/contrib/rest_framework/views.py | Python | mit | 2,841 |
#!/usr/bin/env python3
# Copyright (c) 2016 The Oakcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the bumpfee RPC.
Verifies that the bumpfee RPC creates replacement transactions successfully when
its ... | stratton-oakcoin/oakcoin | test/functional/bumpfee.py | Python | mit | 13,614 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsMapLayerComboBox
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
""... | 3nids/QGIS | tests/src/python/test_qgsmaplayercombobox.py | Python | gpl-2.0 | 10,114 |
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/kasane | kasane/cmd.py | Python | apache-2.0 | 2,701 |
"""
This file demonstrates two different styles of tests (one doctest and one
unittest). These will both pass when you run "manage.py test".
Replace these with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
... | Ecotrust/madrona_addons | mlpa/spacing/tests.py | Python | bsd-3-clause | 535 |
# coding=utf-8
# Copyright 2022 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... | tensorflow/tensor2tensor | tensor2tensor/models/basic_test.py | Python | apache-2.0 | 1,689 |
"""
A top-level linear programming interface. Currently this interface only
solves linear programming problems via the Simplex Method.
.. versionadded:: 0.15.0
Functions
---------
.. autosummary::
:toctree: generated/
linprog
linprog_verbose_callback
linprog_terse_callback
"""
from __future__ import... | kenshay/ImageScript | ProgramData/SystemFiles/Python/Lib/site-packages/scipy/optimize/_linprog.py | Python | gpl-3.0 | 40,117 |
#!/usr/bin/env python
#
# Copyright 2012 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version... | stwunsch/volk-boxmuller | gen/volk_boxmuller_compile_utils.py | Python | gpl-3.0 | 2,215 |
import os
import sys
import imp
import global_settings
class SettingsLoader(object):
def __init__(self):
# load global settings
self._load_settings(global_settings)
local_settings_file = os.environ.get('WEBTELEMETRY_SETTINGS', None)
local_settings = None
if local_settings... | ResearchComputing/web-telemetry | webtelemetry/__init__.py | Python | mit | 698 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.