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 |
|---|---|---|---|---|---|
from unittest import TestCase
try:
from unittest import mock
except ImportError:
import mock
from bettercache.views import BetterView
class TestView(TestCase):
def setUp(self):
self.view = BetterView()
self.view.should_bypass_cache = lambda x: False
self.view.get_cache = lambda x: (... | ironfroggy/django-better-cache | bettercache/tests/test_views.py | Python | mit | 1,632 |
import numpy as np
from imfractal import *
from numpy import recfromcsv
import scipy
import math
import pandas
from pandas import DataFrame, Series
import statsmodels.formula.api as sm
import statsmodels
from statsmodels.tools.eval_measures import aicc, bic, hqic, rmse
import matplotlib.pyplot as plt
from matplotlib.m... | rbaravalle/imfractal | test_paper_BioAsset.py | Python | bsd-3-clause | 30,625 |
# Copyright 2018 Capital One Services, LLC
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
import datetime
from dateutil.parser import parse as date_parse
from unittest import mock
import shutil
import time
from c7n.ctx import ExecutionContext
from c7n.config import Bag, Config
from c7n... | capitalone/cloud-custodian | tools/c7n_gcp/tests/test_output_gcp.py | Python | apache-2.0 | 5,097 |
"""
Copyright 2016, 2017 UFPE - Universidade Federal de Pernambuco
Este arquivo é parte do programa Amadeus Sistema de Gestão de Aprendizagem, ou simplesmente Amadeus LMS
O Amadeus LMS é um software livre; você pode redistribui-lo e/ou modifica-lo dentro dos termos da Licença Pública Geral GNU como publicada pela ... | amadeusproject/amadeuslms | categories/tests/test_views.py | Python | gpl-2.0 | 3,802 |
from collections import defaultdict
from instructions import StaAbsInstruction, LdaImmInstruction, SEIInstruction, CLDInstruction
from memory import RAM
from ppu import PPU
from rom import ROM
from status import Status
RAM_START_INCLUSIVE = int.from_bytes(bytes.fromhex('0000'), byteorder='big')
RAM_END_INCLUSIVE = in... | ThatBenderGuy/pyN3S | cpu.py | Python | gpl-3.0 | 3,328 |
# -*- coding: utf-8 -*-
import re
import time
from module.plugins.internal.Account import Account
class MegaRapidCz(Account):
__name__ = "MegaRapidCz"
__type__ = "account"
__version__ = "0.38"
__status__ = "testing"
__description__ = """MegaRapid.cz account plugin"""
__license__ ... | mationic/pyload | module/plugins/accounts/MegaRapidCz.py | Python | gpl-3.0 | 2,147 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class WithConstraintMet(Package):
"""Package that tests True when specs on directives."""
h... | LLNL/spack | var/spack/repos/builtin.mock/packages/with-constraint-met/package.py | Python | lgpl-2.1 | 686 |
#!/usr/bin/env 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
# "L... | eonezhang/avro | lang/py/test/av_bench.py | Python | apache-2.0 | 2,175 |
# projector - a tool for managing multiple repositories and setting up
# development environments.
# Copyright (C) 2018 Barret Rennie
#
# 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... | brennie/projector | projector/scm_tools/__init__.py | Python | gpl-3.0 | 1,763 |
"""Create START_FILTER_REQUESTS_LENGTH
Revision ID: 808f4e517394
Revises: af2de80654b6
Create Date: 2018-11-29 10:58:02.103458
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
from app.models import cfg_settings
import datetime
# revision identifiers, used by Alembic.
revision... | InQuest/ThreatKB | migrations/versions/808f4e517394_create_start_filter_requests_length.py | Python | gpl-2.0 | 1,247 |
import numpy as np
import pandas as pd
from shapely import prepared
def sjoin(left_df, right_df, how='inner', op='intersects',
lsuffix='left', rsuffix='right', **kwargs):
"""Spatial join of two GeoDataFrames.
left_df, right_df are GeoDataFrames
how: type of join
left -> use keys from le... | urschrei/geopandas | geopandas/tools/sjoin.py | Python | bsd-3-clause | 4,462 |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/model_search | model_search/data/utils.py | Python | apache-2.0 | 5,565 |
#!/usr/bin/env python
# This file has been imported into the apache source tree from
# the IWYU source tree as of version 0.8
# https://github.com/include-what-you-use/include-what-you-use/blob/master/iwyu_tool.py
# and corresponding license has been added:
# https://github.com/include-what-you-use/include-what-yo... | laurentgo/arrow | cpp/build-support/iwyu/iwyu_tool.py | Python | apache-2.0 | 10,318 |
# Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# 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 applicabl... | ramineni/proliantutils | proliantutils/hpssa/types.py | Python | apache-2.0 | 1,503 |
# 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... | Lukasa/cryptography | tests/hazmat/bindings/test_openssl.py | Python | apache-2.0 | 3,198 |
from slList import *
def readFile( filename ):
"""
This function creates a linked list then it opens a file and appends the contents of the file to the linked list.
:param filename: Inputed file
:return: the appended linked list is returned.
"""
myList = createList()
file = open(... | moiseslorap/RIT | Computer Science 1/Homeworks/hw8/testLinkSort.py | Python | mit | 986 |
from frappe import _
def get_data():
return [
{
"label": _("Documents"),
"icon": "icon-star",
"items": [
{
"type": "doctype",
"name": "Lead",
"description": _("Database of potential customers."),
},
{
"type": "doctype",
"name": "Customer",
"description": _("Custome... | Tejal011089/trufil-erpnext | erpnext/config/crm.py | Python | agpl-3.0 | 3,449 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2004-2014 Edgewall Software
# Copyright (C) 2004 Daniel Lundin <daniel@edgewall.com>
# Copyright (C) 2004-2006 Christopher Lenz <cmlenz@gmx.de>
# Copyright (C) 2006 Jonas Borgström <jonas@edgewall.com>
# Copyright (C) 2008 Matt Good <matt@matt-good.net>
# All rights reserved.
#... | pkdevbox/trac | trac/web/session.py | Python | bsd-3-clause | 22,324 |
"""
SPDX-License-Identifier: Apache-2.0
Copyright (c) 2020 Arm Limited. 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 requ... | mbedmicro/mbed | tools/test/travis-ci/scancode-evaluate.py | Python | apache-2.0 | 5,239 |
# -*- coding: utf-8 -*-
# ####################################################################
# Copyright (C) 2005-2013 by the FIFE team
# http://www.fifengine.net
# This file is part of FIFE.
#
# FIFE is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General ... | whiterabbitengine/fifeplusplus | tools/editor/scripts/gui/__init__.py | Python | lgpl-2.1 | 1,143 |
#!/usr/bin/env python
#
# PySTDF - The Pythonic STDF Parser
# Copyright (C) 2006 Casey Marshall
#
# 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 o... | cmars/pystdf | setup_py2exe.py | Python | gpl-2.0 | 5,187 |
# -*- coding: utf-8 -*-
import os
def cubicbezier(self, x0, y0, x1, y1, x2, y2, x3, y3, n=20):
pts = []
for i in range(n + 1):
t = i / n
a = (1. - t)**3
b = 3. * t * (1. - t)**2
c = 3.0 * t**2 * (1.0 - t)
d = t**3
x = int(a * x0 + b * x1 + c * x2 + d * x3)
... | NicovincX2/Python-3.5 | Représentations graphiques/Bitmap/bitmap_cubic_bezier.py | Python | gpl-3.0 | 1,174 |
#!/usr/bin/env python3
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "getresults_order.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| botswana-harvard/getresults-order | manage.py | Python | gpl-2.0 | 260 |
import os
import unittest
from autoprefixer.compiler import autoprefixer, AutoprefixerError
from js_host.conf import settings
settings.configure(USE_MANAGER=True)
TEST_CSS_FILE = os.path.join(os.path.dirname(__file__), 'test.css')
class TestDjangoFrontendTools(unittest.TestCase):
def test_autoprefixer_can_proce... | markfinger/python-autoprefixer | tests/tests.py | Python | mit | 1,036 |
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
from django.core.management.base import BaseCommand, CommandError
from django.test.client import Client
from django.urls import reverse
from django.conf import settings
from myuw.urls import urlpatterns
from myuw.test.api import get... | uw-it-aca/myuw | myuw/management/commands/myuw_speed_matrix.py | Python | apache-2.0 | 2,762 |
# -*- coding: utf-8 -*-
#
# OpenCraft -- tools to aid developing and hosting free software projects
# Copyright (C) 2015 OpenCraft <xavier@opencraft.com>
#
# 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 Soft... | omarkhan/opencraft | instance/tests/integration/factories/instance.py | Python | agpl-3.0 | 1,964 |
#!/usr/bin/env python
import sys
import argparse
import numpy as np
from mapTools import *
from utilities import filesFromList, writeLog
from plotTools import addImagePlot, addContourf, addScatterPlot
import matplotlib.pyplot as plt
'''
Description:
Author: Mikko Auvinen
mikko.auvinen@helsinki.fi
Univ... | saskartt/P4UL | pyRaster/addBlockMargin.py | Python | mit | 4,134 |
import difflib
from pyprint.ConsolePrinter import ConsolePrinter
from coalib.results.result_actions.ResultAction import ResultAction
from coalib.results.Result import Result
def format_line(line, real_nr="", sign="|", mod_nr="", symbol="", ):
return "|{:>4}{}{:>4}|{:1}{}".format(real_nr,
... | scriptnull/coala | coalib/results/result_actions/ShowPatchAction.py | Python | agpl-3.0 | 3,352 |
#!/usr/bin/env python
# -*- coding: latin-1 -*-
"""
"""
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
import math
import random
import re
import os.path
import pyglet
from pyglet.gl import *
import xml.dom
import xml.dom.minidom
class SmoothLineGroup(pyglet.graphics.Group):
def set_state(self):
... | bitcraft/pyglet | contrib/experimental/svg_test.py | Python | bsd-3-clause | 14,032 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding index on 'Commit', fields ['repository_id', 'date_added']
db.cre... | JackDanger/sentry | src/sentry/south_migrations/0274_auto__add_index_commit_repository_id_date_added.py | Python | bsd-3-clause | 60,056 |
from django.conf.urls import patterns, url
from django.views.generic import TemplateView
urlpatterns = patterns(
'',
url(r'^manifesto$', TemplateView.as_view(template_name='docs/manifesto.html'), name='docs_manifesto'),
url(r'^about$', TemplateView.as_view(template_name='docs/about.html'), name='docs_about... | urlist/devcharm | docs/urls.py | Python | gpl-3.0 | 532 |
# Import the Solver class
from Solver import *
# Ask for file path
satFile = raw_input("Enter path to CNF file: ")
# Create a SAT problem to solve
x = Solver(satFile)
# Now solve the SAT problem (finding all solutions)
solutions = x.simpleSolveAll()
# Print out all solutions
print "Solutions:\n", solutions
| VictorLoren/python-sat-solver | runMe.py | Python | mit | 313 |
import os
import webapp2
import jinja2
import webapp2
import json
from google.appengine.ext import ndb
JINJA_ENVIRONMENT = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.dirname(__file__)),
extensions=['jinja2.ext.autoescape'],
autoescape=True)
class UserRating(ndb.Model):
username = ndb... | msavoury/machine-learning | apps/rateawatch/rateawatch.py | Python | mit | 2,526 |
from pypers.core.step import Step
from pypers.steps.mothur import Mothur
import os
import json
import re
class MothurGetGroups(Mothur):
"""
The get.groups command selects sequences from a specific group or set of groups from the following file types: fasta, name, group, list, taxonomy.
"""
spec = {
... | frankosan/pypers | pypers/steps/mothur/MothurGetGroups.py | Python | gpl-3.0 | 2,992 |
import logging
import re
import operator
from google.appengine.ext import db
from django.shortcuts import redirect
from piston.handler import BaseHandler
from piston.utils import rc, throttle
from appengine_django.auth import models as authModels
from app import models, forms
class SearchHandler(BaseHandler):
all... | greggian/TapdIn | app/handlers.py | Python | apache-2.0 | 8,408 |
from nectr.chat import consumers
channel_routing = [
consumers.ChatServer.as_route(path=r"^/ws-chat/")
]
| nectR-Tutoring/nectr | config/routing.py | Python | mit | 111 |
#!/usr/bin/env python3
# TODO, anyway to better protect F?
import ctypes as ct
class _FlagBits(ct.Structure):
_fields_ = [
('_zero', ct.c_ubyte, 4),
('c_flag', ct.c_ubyte, 1),
('h_flag', ct.c_ubyte, 1),
('n_flag', ct.c_ubyte, 1),
('z_flag', ct.c_ubyte, 1),
]
class _F... | aanunez/bbboy | bbboy/registers.py | Python | gpl-3.0 | 2,960 |
"""Utilities for writing code that runs on Python 2 and 3"""
# Copyright (c) 2010-2013 Benjamin Peterson
#
# 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 with... | arokem/PyEMMA | pyemma/_ext/six.py | Python | bsd-2-clause | 20,765 |
# i need to put the scores in order from highest to least in a list, heres how:
# 1. open the file
# 2. split the names and scores
# 3.create an array and put the scores into the array
# 4. sort the scores
# 5. print the scores
scores={}
results=open("report_card")
for line in results:
(name, score)=line.split()... | vollov/python-test | dudu/2021-01-07.py | Python | mit | 537 |
#!/usr/bin/python
import StringIO
import urllib
import urllib2
from lxml import etree
class NcaaGrabber:
def __init__(self):
self.ncaaUrl = 'http://web1.ncaa.org'
self.ncaaStatsSite = self.ncaaUrl+'/football/exec/rankingSummary'
# self.ncaaTeamList2008 = self.ncaaUrl+'/mfb/%d/Interne... | cbuntain/ncaa_football_predictor | Grabber/StatsClass.py | Python | bsd-2-clause | 7,312 |
import pyglet
from random import random as r
from board import Board
from math import floor
cursor = None
xi, yi = 30, 30
x, y = xi, yi
lvl = 5
starts = True
mines = Board(xi, yi, lvl)
flag_mode = False
brd = {(_x,_y) for _x in range(x) for _y in range(y)}
scale = 20
black = 0, 0, 0, 255
white = 255, 255, 255
pur... | thismachinechills/minesqeeper | mines_pyglet.py | Python | gpl-3.0 | 4,042 |
# Copyright 2013 OpenStack Foundation
#
# 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... | jumpstarter-io/keystone | keystone/tests/unit/test_v3_credential.py | Python | apache-2.0 | 16,723 |
# Copyright (C) 2010-2014 CEA/DEN, EDF R&D
#
# 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
# version 2.1 of the License, or (at your option) any later version.
#
# This library ... | FedoraScientific/salome-paravis | test/VisuPrs/CutLines/E5.py | Python | lgpl-2.1 | 1,506 |
import json
import logging
from couchdbkit import ResourceNotFound
from django.utils.encoding import force_unicode
from django_countries.countries import COUNTRIES
from phonenumbers import COUNTRY_CODE_TO_REGION_CODE
from django.utils.translation import ugettext_lazy as _
from corehq.apps.accounting.utils import fmt_do... | SEL-Columbia/commcare-hq | corehq/apps/smsbillables/async_handlers.py | Python | bsd-3-clause | 4,044 |
# Copyright 2017 Telstra Open Source
#
# 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 agre... | jonvestal/open-kilda | src-python/lab-service/traffexam/kilda/traffexam/exc.py | Python | apache-2.0 | 5,615 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# MonsterTV Regex de streamingfreetv
# Version 0.1 (17.10.2014)
#------------------------------------------------------------
# License: GPL (http://www.gnu.org/licenses/gpl-3.0.html)
# Gracias a la librería plugintools de Jesús (www.... | manusev/plugin.video.kuchitv | resources/regex/streamingfreetv.py | Python | gpl-2.0 | 4,423 |
'''
Created on Jul 7, 2014
@author: viejoemer
How to test if the element from a set is in other in Python?
¿Cómo comprobar si los elemento de un set estan en otro set en Python?
issuperset(other)
set >= other
Test whether every element in other is in the set.
set > other
Test whether the set is a proper superset o... | OxPython/Python_set_issuperset | src/set_issuperset.py | Python | epl-1.0 | 1,260 |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2013,2014,2015,2017 Contributor
#
# 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 Li... | quattor/aquilon | tests/broker/networktest.py | Python | apache-2.0 | 11,183 |
from imp import reload
from typing import Any, Sequence, Tuple, Union
import pytest
import polypie
@pytest.fixture(autouse=True)
def reload_polypie():
reload(polypie)
def test_without_annotations():
@polypie.polymorphic
def f():
return 0
@polypie.polymorphic
def f(a):
return ... | un-def/polypie | tests/test_polypie.py | Python | bsd-2-clause | 5,791 |
"""
An ndarray subclass for working with arrays of strings.
"""
from functools import partial, total_ordering
from operator import eq, ne
import re
import numpy as np
from numpy import ndarray
import pandas as pd
from toolz import compose
from zipline.utils.compat import unicode
from zipline.utils.functional import i... | quantopian/zipline | zipline/lib/labelarray.py | Python | apache-2.0 | 28,229 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'ContactMessage'
db.create_table('website_contactmessage', (
('id', self.gf('djan... | audaciouscode/Roxy-Proxy | roxy/website/migrations/0001_initial.py | Python | gpl-3.0 | 1,538 |
# 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... | apache/incubator-airflow | airflow/api/auth/backend/basic_auth.py | Python | apache-2.0 | 2,258 |
import os
import pandas as pd
from .config import get_sch_ref_df
from . import simple_cysh as cysh
sch_ref_df = get_sch_ref_df()
def academic_sections_to_create():
"""
Gather ACM deployment docs to determine which 'Tutoring: Math' and 'Tutoring: Literacy' sections to make
"""
xl = pd.ExcelFile(r'Z:... | mrklees/cy-automation-library | cyautomation/cyschoolhouse/section_creation_chi.py | Python | gpl-3.0 | 7,625 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2020-05-14 06:33
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cron', '0001_initial'),
]
operations = [
migrat... | Spoken-tutorial/spoken-website | cron/migrations/0002_auto_20200514_1203.py | Python | gpl-3.0 | 725 |
# http://realiseyourdreams.wordpress.com/latex-scripts/
#Script to remove all LaTex-Comments from .tex-files
import os,subprocess
#browse the directory
for dirname, dirnames, filenames in os.walk('.'):
for filename in filenames:
#Check every file for:
filepath = os.path.join(dirname, filename)
#tex file
if file... | rvelseg/MuDoVLaGM | utils/removeLatexComments.py | Python | gpl-3.0 | 1,034 |
import os,logging
from autotest.client.shared import error
from virttest import utils_test
def run_9p(test, params, env):
"""
Run an autotest test inside a guest.
@param test: kvm test object.
@param params: Dictionary with test parameters.
@param env: Dictionary with the test environment.
""... | ehabkost/virt-test | qemu/tests/9p.py | Python | gpl-2.0 | 1,818 |
# Copyright (c) 2013 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | joshuamckenty/stackalytics | stackalytics/processor/vcs.py | Python | apache-2.0 | 8,415 |
# -*- coding: utf-8 -*-
# Copyright 2017 Ignacio Ibeas <ignacio@acysos.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, models
class AccountInvoice(models.Model):
_inherit = 'account.invoice'
@api.multi
def _connect_wsdl(self, wsdl, port_name):
self.ensur... | acysos/odoo-addons | l10n_es_aeat_sii_navarra/models/account_invoice.py | Python | agpl-3.0 | 1,550 |
#!/usr/bin/env python
#
# Copyright 2019 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 requir... | googleads/googleads-python-lib | examples/ad_manager/v202111/targeting_preset_service/get_all_targeting_presets.py | Python | apache-2.0 | 1,892 |
import os
f = open('clientcalls')
f2 = open('times')
BUCKET=250
CASE=os.getenv('CASE')
sums = []
cnt = 0
tmp = 0
try:
for s in f:
parts = s.split(',')
if len(parts) != 2: continue
v_total = float(parts[1])
v_off = float(f2.next())
v = v_total - v_off
tmp += v
... | wayetender/whip | benchmarks/parse_results/parse.py | Python | gpl-2.0 | 1,744 |
from pynhost import matching, dynamic, utilities
class Command:
def __init__(self, words):
self.words = words
self.remaining_words = words
self.action_lists = []
def set_results(self, gram_handler, log_handler):
while self.remaining_words:
action_list = ActionList(s... | evfredericksen/pynacea | pynhost/pynhost/commands.py | Python | mit | 4,812 |
#
# (c) 2016 Red Hat Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is d... | nrwahl2/ansible | lib/ansible/plugins/connection/network_cli.py | Python | gpl-3.0 | 11,931 |
import requests
from django.core.management.base import BaseCommand
from django.core.files.base import ContentFile
from candidates.models import Ballot
from elections.models import Election
from official_documents.models import OfficialDocument
class Command(BaseCommand):
"""This command uses the ballots endpoi... | DemocracyClub/yournextrepresentative | ynr/apps/sopn_parsing/management/commands/sopn_tooling_create_official_documents.py | Python | agpl-3.0 | 4,476 |
from __future__ import division
from numba import autojit
import numpy as np
from math import sqrt
__author__ = 'larry'
def calc_nucl_repulsion(atom_charge, cart_matrix):
"""calculates the nuclear repulsion energy between atoms in system
Parameters
----------
atom_charge : array-like
... | LT12/LTPsi | molecular_props.py | Python | gpl-2.0 | 2,273 |
from setuptools import setup
setup(
name='sfdc-bulk',
packages=['sfdc_bulk'],
version='0.2',
description='Python client library for SFDC bulk API',
url='https://github.com/donaldrauscher/sfdc-bulk',
author='Donald Rauscher',
author_email='donald.rauscher@gmail.com',
license='MIT',
i... | donaldrauscher/sfdc-bulk | setup.py | Python | mit | 430 |
import sys
sys.path += ["."]
import os
os.environ['DJANGO_SETTINGS_MODULE']='solalim.settings'
import django
django.setup()
from floreal import models as m
import re
months={
"janvier": 1,
"février": 2,
"fevrier": 2,
"mars": 3,
"avril": 4,
"mai": 5,
"juin": 6,
"juillet": 7,
"août":... | fab13n/caracole | solalim/stats.py | Python | mit | 2,120 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright: 2015 Bastian Blank
# License: MIT, see LICENSE.txt for details.
import array
import struct
import time
import sys
import os
from uuid import uuid4
class VHDFooter:
_struct = struct.Struct('>8sLLQL4sL4sQQ4sLL16sB427x')
size = _struct.size
vhd_ti... | UnicronNL/vyos-build | scripts/vhd.py | Python | gpl-2.0 | 2,790 |
class SftpException(Exception):
pass
class SftpError(SftpException):
pass
class SftpAlreadyExistsError(SftpError):
pass
class SshException(Exception):
pass
class SshError(SshException):
pass
class SshLoginError(SshError):
pass
class SshHostKeyException(SshException):
pass
class Ss... | dsoprea/PySecure | pysecure/exceptions.py | Python | gpl-2.0 | 484 |
import os, time, shutil
from subprocess import Popen, PIPE
from script import Script
import tools, setup
def s2m(s):
m = int((s * 10)/60)/10
return m if m <= 10 else int(m)
def build_combo(fn, config, platform):
print('building {0} {1} {2}...'.format(fn.__name__, config, platform))
bat = Script(True,... | ferruccio/cclibs | build.py | Python | unlicense | 8,027 |
# Copyright 2016 OpenStack Foundation
# 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 requ... | bswartz/cinder | cinder/tests/unit/test_quota_utils.py | Python | apache-2.0 | 10,416 |
# Copyright (C) 2013 Equinor ASA, Norway.
#
# The file 'config_parser.py' is part of ERT - Ensemble based Reservoir Tool.
#
# ERT 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 L... | joakim-hove/ert | res/config/config_parser.py | Python | gpl-3.0 | 4,152 |
import calendar
from datetime import timedelta, date
from django.utils import timezone
from gerencex.core.models import Restday, Absences, HoursBalance
from gerencex.core.time_calculations import DateData
def dates(date1, date2):
"""
:param date1: begin date
:param date2: end date
:return: all dates ... | flavoso/gerencex | gerencex/core/functions.py | Python | gpl-3.0 | 6,476 |
# -*- coding: utf-8 -*-
# Amara, universalsubtitles.org
#
# Copyright (C) 2013 Participatory Culture Foundation
#
# 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 L... | wevoice/wesub | apps/subtitles/views.py | Python | agpl-3.0 | 19,462 |
""" A model of an Infrastructure Datastore in CFME
"""
import attr
from lxml.html import document_fromstring
from navmazing import NavigateToAttribute
from widgetastic.exceptions import NoSuchElementException
from widgetastic.utils import Version, VersionPick
from widgetastic.widget import ParametrizedView, View, Text
... | lkhomenk/integration_tests | cfme/infrastructure/datastore.py | Python | gpl-2.0 | 15,869 |
from oscar.apps.shipping.admin import *
| lyoniionly/django-cobra | sites/sandbox/apps/shipping/admin.py | Python | apache-2.0 | 40 |
# blaplay, Copyright (C) 2012 Niklas Koep
# 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.
# This program is distribut... | nkoep/blaplay | blaplay/blagui/blatagedit.py | Python | gpl-2.0 | 15,606 |
from __future__ import annotations
from typing import Any
import pandas._libs.json as json
from pandas._typing import (
FilePath,
StorageOptions,
WriteExcelBuffer,
)
from pandas.io.excel._base import ExcelWriter
from pandas.io.excel._util import (
combine_kwargs,
validate_freeze_panes,
)
class ... | pandas-dev/pandas | pandas/io/excel/_xlsxwriter.py | Python | bsd-3-clause | 8,835 |
import pytest
import dask
from dask.order import ndependencies, order
from dask.core import get_deps
from dask.utils_test import add, inc
@pytest.fixture(params=['abcde', 'edcba'])
def abcde(request):
return request.param
def issorted(L, reverse=False):
return sorted(L, reverse=reverse) == L
def f(*args)... | kenshay/ImageScript | ProgramData/SystemFiles/Python/Lib/site-packages/dask/tests/test_order.py | Python | gpl-3.0 | 12,295 |
#
# Copyright 2013 eNovance <licensing@enovance.com>
# Copyright 2013 Red Hat, 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
#
# Unl... | ityaptin/ceilometer | ceilometer/storage/sqlalchemy/migrate_repo/versions/007_add_alarm_table.py | Python | apache-2.0 | 1,821 |
import wx
import os
import re
import time
import inspect
cmdFolder = os.path.realpath(os.path.abspath(os.path.split(inspect.getfile( inspect.currentframe() ))[0]))
from settings import Settings
from cnc import CNC
from gcframe import GcFrame, RETRACTIONCOLOR, REVRETRACTIONCOLOR, PRINTCOLOR
from gclistctrl import Gco... | jbernardis/repraptoolbox | src/GEdit/gedit.py | Python | gpl-3.0 | 33,435 |
from django.test import TestCase
from dojo.tools.ort.parser import OrtParser
from dojo.models import Test
class TestOrtParser(TestCase):
def test_parse_without_file_has_no_finding(self):
parser = OrtParser()
findings = parser.get_findings(None, Test())
self.assertEqual(0, len(findings))
... | rackerlabs/django-DefectDojo | dojo/unittests/tools/test_ort_parser.py | Python | bsd-3-clause | 646 |
# Departing.io, a web app to answer the question of "When will the next bus come?"
# Copyright (C) 2016 Jake Coppinger
# 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 Li... | jakecoppinger/departing.io | nxtbus_stops.py | Python | gpl-3.0 | 1,313 |
import buzzbot.background_runner
import buzzbot.bot
import buzzbot.botUtilities
import buzzbot.commands
import buzzbot.cpu_core_counter
import buzzbot.crawler
import buzzbot.feedparser
import buzzbot.model
import buzzbot.searcher
import buzzbot.visitor
import logging
| pbarton666/buzz_bot | bot_project/buzzbot/__init__.py | Python | mit | 281 |
# coding: utf-8
from __future__ import unicode_literals
from datetime import date
from django.contrib.gis.geos import GEOSGeometry
from boundaries.models import BoundarySet, Boundary
from boundaries.tests import ViewTestCase, ViewsTests, PrettyTests, PaginationTests, BoundaryListTests
class BoundaryListSetTestCase... | datamade/represent-boundaries | boundaries/tests/test_boundary_list_set.py | Python | mit | 3,252 |
#!/usr/bin/env python
import rospy
import actionlib
import random
import vrep
import time
import numpy as np
import geometry_msgs.msg
import std_msgs.msg
import os
from geometry_msgs.msg import Twist, Pose, Vector3
from kobuki_msgs.msg import BumperEvent
from nav_msgs.msg import Odometry
from move_base_msgs.msg import... | EricssonResearch/scott-eu | simulation-ros/src/turtlebot2i/turtlebot2i_safety/src/environment_cnn.py | Python | apache-2.0 | 27,593 |
#!/usr/bin/env python
"""
Install the packages necessary for building conda
distributions.
Requires conda to be installed and on the path.
There are scripts to help with the installation of
miniconda in the same directory as this script.
"""
from __future__ import print_function
BUILD_PACKAGES = ['conda-build', 'anac... | pelson/Obvious-CI | scripts/obvci_install_conda_build_tools.py | Python | bsd-3-clause | 522 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2010-2011 University of California, Berkeley, 2005-2009 University of Washington
# See opus_core/LICENSE
import os, inspect, traceback, re
from opus_core.tests import opus_unittest
from opus_core.logger import logger
class TestScanner(object):
def find... | apdjustino/DRCOG_Urbansim | src/opus_core/tests/utils/test_scanner.py | Python | agpl-3.0 | 7,287 |
# Sieve of Eratosthenes: The sieve of Eratosthenes is one of the most efficient ways
# to find all of the smaller primes (below 10 million or so).
import math
def sieve(n):
prime = [False] * n
i = 2
while i < n:
prime[i] = True
i += 1
i = 2
while (i * i) < n:
if prime[i]:
j = 0
while (i * i + i * ... | idunnowhy9000/Projects | SOURCE/Python/Classic Algorithms/Sieve of Eratosthenes.py | Python | mit | 659 |
import sys
"""
INPUT:
hat
abc
Zu6
"""
def str_perm(word):
result = []
if len(word) == 1:
result = [word]
else:
for position, letter in enumerate(word):
for permutation in str_perm(word[:position] + word[position+1:]):
result.append(letter + permutation)
r... | tyop/CodeEval | string_permutations.py | Python | mit | 443 |
import codecs
import re
import types
import sys
from constants import EOF, spaceCharacters, asciiLetters, asciiUppercase
from constants import encodings, ReparseException
#Non-unicode versions of constants for use in the pre-parser
spaceCharactersBytes = frozenset([str(item) for item in spaceCharacters])
asciiLetters... | havard024/prego | venv/lib/python2.7/site-packages/html5lib/inputstream.py | Python | mit | 27,975 |
from sneakers.modules import Encoder, Parameter
from Crypto.Cipher import PKCS1_OAEP
from Crypto.PublicKey import RSA as cryptoRSA
class Rsa(Encoder):
info = {
"name": "RSA",
"author": "davinerd",
"description": "Encrypts data using RSA",
"comments": []
}
params = {
... | davinerd/sneaky-creeper | sneakers/encoders/rsa.py | Python | mit | 1,250 |
import unittest
from lxml import html
from .boner import HtmlBoner
from .chunker import Elt, TextChunk, SkipChunk, HtmlChunker
from .exceptions import MismatchingText, UnasignableChunk
class IntroduceSemanticsTestCase(unittest.TestCase):
def setUp(self):
self.chunker = HtmlChunker()
def deconstruct... | jurismarches/boned-html | boned_html/tests.py | Python | mit | 10,546 |
# coding=utf-8
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: https://sickchill.github.io
#
# This file is part of SickChill.
#
# SickChill 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 th... | coderbone/SickRage-alt | sickbeard/metadata/wdtv.py | Python | gpl-3.0 | 10,008 |
# Copyright (C) 2001-2017 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and this permission notice
# appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND ... | pbaesse/Sissens | lib/python2.7/site-packages/eventlet/support/dns/rdata.py | Python | gpl-3.0 | 13,071 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig
class LoginConfig(AppConfig):
name = 'login'
| InspectorIncognito/visualization | login/apps.py | Python | gpl-3.0 | 150 |
"""
make_base_installers.py --
Build the installers for one or more of the supported operating systems,
depending on options given. Runs on Linux systems only.
Usage: python make_base_installer.py m|l|w|i|a|t path/to/trunk/ pubkey
privkey output/dir/ [version of seattle]
[--wg path/to/Windows... | SeattleTestbed/dist | make_base_installers.py | Python | mit | 28,125 |
from django import forms
from cyder.cydns.forms import DNSForm
from cyder.cydns.ptr.models import PTR
from cyder.cydhcp.forms import RangeWizard
from cyder.base.mixins import UsabilityFormMixin
class PTRForm(DNSForm, RangeWizard, UsabilityFormMixin):
def __init__(self, *args, **kwargs):
super(PTRForm, s... | OSU-Net/cyder | cyder/cydns/ptr/forms.py | Python | bsd-3-clause | 848 |
# -*- coding: utf-8 -*-
# (c) 2015 Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
import openerp.tests.common as common
class TestSaleOrderPriceRecalculation(common.TransactionCase):
def setUp(self):
super(TestSaleOrderPriceRecalculation,... | Rona111/sale-workflow | sale_order_price_recalculation/tests/test_sale_order_price_recalculation.py | Python | agpl-3.0 | 1,988 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# This is rating counter
# author: Alex Shteinikov
import __init__
import settings
import time
import random
tweenk_core = settings.core()
tweenk_balance = settings.balance()
import db
import logger
import time
class ratingsCounter:
K1 = 0.02
K2 = 1... | MicroWorldwide/tweeria | tools/ratings.py | Python | mit | 8,313 |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import (
compat_str,
compat_urlparse,
)
from ..utils import (
clean_html,
determine_ext,
ExtractorError,
int_or_none,
parse_duration,
try_get,
url_or_none,
)
from .dai... | kidburglar/youtube-dl | youtube_dl/extractor/francetv.py | Python | unlicense | 19,069 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.