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 -*-
__author__ = 'vkwk'
import re
import sys
import json
import requests
reload(sys)
sys.setdefaultencoding('utf8')
def getHtml(ip):
# print ip
page = requests.get('http://ip.taobao.com/service/getIpInfo.php?ip=' + ip)
if page.status_code==200:
return page.co... | VikingWarlock/find-location-nginx | getIP.py | Python | mit | 2,351 |
# 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)
import os.path
from spack import *
class AperturePhotometry(Package):
"""Aperture Photometry Tool APT is software f... | LLNL/spack | var/spack/repos/builtin/packages/aperture-photometry/package.py | Python | lgpl-2.1 | 1,372 |
import unittest
import sys
import os
sys.path.append(os.getcwd())
from AIToolbox import MDP
class MDPPythonQLearningTests(unittest.TestCase):
def testUpdates(self):
solver = MDP.QLearning(5, 5, 0.9, 0.5)
# State goes to itself, thus needs to consider
# next-step value.
solver.ste... | Svalorzen/AI-Toolbox | test/Python/MDP/QLearningTests.py | Python | gpl-3.0 | 1,101 |
# Generated by Django 1.11.4 on 2017-08-30 14:08
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("institutions", "0014_auto_20170822_1403")]
operations = [
migrations.AlterField(
model_name="institution",
name="parents",
... | watchdogpolska/feder | feder/institutions/migrations/0015_auto_20170830_1408.py | Python | mit | 570 |
#@+leo-ver=5-thin
#@+node:lee.20141215164031.94: * @file example.py
#@@language python
#@@tabwidth -4
#@+<<decorations>>
#@+node:lee.20141215164031.95: ** <<decorations>>
import cherrypy
import random
from std.asciisymbol import asciiImage
from wsgi import env
#@-<<decorations>>
#@+others
#@+node:lee.20141215164031.96... | dora40323106/2014cpa_final_project | std/a40323155.py | Python | gpl-3.0 | 7,761 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-11-15 09:43
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('lava_scheduler_app', '0029_remove_testjob__results_bundle'),
]
operations = [
migra... | Linaro/lava-server | lava_scheduler_app/migrations/0030_unused_scheduler_fields.py | Python | agpl-3.0 | 942 |
#!/usr/bin/python
# Copyright 2011 The Android Open Source Project
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This script is a wrapper which invokes gyp with the correct --depth argument,
# and supports the automatic regeneration of build files if all.gyp... | javedulu/SkiaExampleGL | gyp_using_skia.py | Python | gpl-3.0 | 6,234 |
#!/usr/bin/env python
from umlgen.state.model import *
from umlgen.state.writer import XMLWriter
from umlgen.state.reader import XMLReader
def main():
initial = InitialState()
s1 = State("Opened")
transition_initial_s1 = Transition(initial, s1, "Create")
final = FinalState()
transition_s1_final = Transition(s1, ... | perfidia/umlgen | src/mainState.py | Python | mit | 878 |
import json
import threading
import sublime
import sublime_plugin
import analytics
import uuid
from elasticsearch import Elasticsearch
from elasticsearch_connections import CustomHeadersConnection
from abc import ABCMeta, abstractmethod
from ..panel import IndexListPanel
from ..panel import DocTypeListPanel
from ..pa... | KunihikoKido/sublime-elasticsearch-client | commands/base.py | Python | mit | 10,147 |
from __future__ import absolute_import
import copy
from unittest import TestCase
import plotly.graph_objs as go
from plotly.graph_objs import Figure
from plotly.subplots import make_subplots
class TestSelectForEachUpdateSubplots(TestCase):
def setUp(self):
fig = make_subplots(
rows=3,
... | plotly/python-api | packages/python/plotly/plotly/tests/test_core/test_update_objects/test_update_subplots.py | Python | mit | 16,736 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from typing import (Dict, Union, List)
from science.tools.protocols import Protocol
from science.tools.utils import imgur_parser
class TestProtocol(unittest.TestCase):
def setUp(self) -> None:
self.protocol: Protocol = Protocol(200, "Hello Wo... | faruken/science | tests/test_tools.py | Python | gpl-3.0 | 1,296 |
import chemistry
from openmoltools import cirpy
import mdtraj as md
import pymbar
import os
import pandas as pd
import glob
import dipole_errorbars
from density_simulation_parameters import DATA_PATH
num_bootstrap = 100
fixed_block_length = 20 # 200 ps blocks for dielectric error bar block averaging.
prmtop_filename... | choderalab/LiquidBenchmark | src/munge_output_amber.py | Python | gpl-2.0 | 2,349 |
# Copyright (c) 2021 Daniel Campos <danielcampos@avanzosc.es> - Avanzosc S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class ResPartner(models.Model):
_inherit = "res.partner"
def _get_default_commercial(self):
""" Gives default commercial ... | avanzosc/odoo-addons | partner_commercial_by_language/models/res_partner.py | Python | agpl-3.0 | 1,477 |
# -*- coding: utf-8 -*-
# Copyright 2013,2014 Georgia Institute of Technology.
#
# 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
#... | smallk/smallk | pysmallk/tests/preprocessor.py | Python | apache-2.0 | 2,211 |
#
# Some contents of this file is part of the PyRDP project.
# Copyright (C) 2018 GoSecure Inc.
# Licensed under the GPLv3 or later.
#
import struct
class Integer:
FORMAT = ""
@classmethod
def pack(cls, value):
data_bytes = struct.pack(cls.FORMAT, value)
return data_bytes
# 8 bits
class Int8(Intege... | johnnykv/heralding | heralding/libs/msrdp/packer.py | Python | gpl-3.0 | 740 |
# MIT License
# Copyright (c) 2017 Tuxedo
# 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... | TuXiaokang/pyseeta | pyseeta/identifier.py | Python | mit | 6,817 |
# Tulpenmanie, a markets client.
# Copyright (C) 2012 Emery Hemingway
#
# 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.... | volak/tulpenmanie | tulpenmanie/network/__init__.py | Python | gpl-3.0 | 5,507 |
from graphics import *
def main():
winWidth = 200 # give a name to the window width
winHeight = 150 # and height
win = GraphWin('Face', winWidth, winHeight) # give title and dimensions
win.setCoords(0, 0, winWidth, winHeight) # make right side up coordinates!
head = Circle(Point(40,100), 25) # set c... | shubhmsng/Codes | python codes/gui.py | Python | gpl-2.0 | 823 |
# encoding: 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):
# Deleting field 'ZornaCalendar.content_type'
db.delete_column('zorna_calendars', 'content_type_id')
... | zorna/zorna | zorna/calendars/migrations/0002_removed_content_type.py | Python | bsd-3-clause | 6,710 |
#!/usr/bin/env python
import sys
import json
import logging
from logging import warning, error, info
from math import pi, degrees
from PyQt4 import Qt, QtCore, QtGui
from connection import Connection
arrow_points = (
Qt.QPoint(-1, -4),
Qt.QPoint(1, -4),
Qt.QPoint(1, 4),
Qt.QPoint(4, 4),
Qt.QPoin... | zwarren/morse-car-controller | user/map.py | Python | mit | 7,092 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Reading XLS file with temperature (sample)
Calculating degree days
Plotting
"""
import click
import os
import datetime
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.dates as dates
from pandas_degreedays import calculate_dd,... | scls19fr/pandas_degreedays | sample/calc_degreedays_from_excel.py | Python | bsd-3-clause | 4,227 |
import json
from credo.auth_helper import get_request_referer_from_other_domain, get_saved_referer, save_referer
from credo_modules.models import CourseUsage, get_unique_user_id, UNIQUE_USER_ID_COOKIE, update_unique_user_id_cookie,\
usage_dt_now
from django.conf import settings
from django.db import IntegrityError,... | CredoReference/edx-platform | common/djangoapps/credo_modules/middleware.py | Python | agpl-3.0 | 6,104 |
from urllib import urlencode
from md5 import md5
from tornado.testing import AsyncHTTPTestCase
from tornado.web import create_signed_value
from redis import Redis
from server import application
import server
class AdminTestCase(AsyncHTTPTestCase):
def _secure_cookie(self, name, value):
return create_si... | Computiva/carbono | test/test_admin.py | Python | mit | 4,848 |
from typing import List
from pydantic import BaseModel
class Foo(BaseModel):
count: int = ...
size: float = None
class Bar(BaseModel):
apple = 'x'
banana = 'y'
class Spam(BaseModel):
foo: Foo = ...
bars: List[Bar] = ...
m = Spam(foo={'count': 4}, bars=[{'apple': 'x1'}, {'apple': 'x2'}])
pri... | petroswork/pydantic | docs/examples/recursive.py | Python | mit | 555 |
# -*- coding: utf-8 -*-
#VERSION: 1.4
#AUTHORS: Anatoly Mayorov (mmajor@yandex.ru), Konstantin Lebedev (whitef0x@ya.ru)
# This plugin is licensed under the GNU GPL Version 2.
from novaprinter import prettyPrinter
from helpers import download_file, htmlentitydecode
import http.cookiejar
import re
import gzip
from io im... | andrewbell8/dotfiles | config/qbittorrent/nova3/engines/rutor.py | Python | bsd-2-clause | 5,290 |
#
# Secret Labs' Regular Expression Engine
#
# various symbols used by the regular expression engine.
# run this script to update the _sre include files!
#
# Copyright (c) 1998-2001 by Secret Labs AB. All rights reserved.
#
# See the sre.py file for information on usage and redistribution.
#
"""Internal support modul... | ceramos/micropython | tests/bytecode/pylib-tests/sre_constants.py | Python | mit | 7,147 |
#!/usr/bin/env python2
# coding=utf-8
#
##############################################################################
### NZBGET POST-PROCESSING SCRIPT ###
# Post-Process to Mylar.
#
# This script sends the download to your automated media management servers.
#
# NOTE: This sc... | bbsan2k/nzbToMedia | nzbToMylar.py | Python | gpl-3.0 | 3,087 |
"""Tests for Renault setup process."""
from unittest.mock import patch
import aiohttp
from renault_api.gigya.exceptions import InvalidCredentialsException
from homeassistant.components.renault.const import DOMAIN
from homeassistant.config_entries import ConfigEntryState
from homeassistant.core import HomeAssistant
f... | Danielhiversen/home-assistant | tests/components/renault/test_init.py | Python | apache-2.0 | 2,521 |
#!/usr/bin/env python
#
# cppcheck addon for naming conventions
#
# Example usage (variable name must start with lowercase, function name must start with uppercase):
# $ cppcheck --dump path-to-src/
# $ python addons/naming.py --var='[a-z].*' --function='[A-Z].*' path-to-src/*.dump
#
import cppcheckdata
import sys
imp... | matthiaskrgr/cppcheck | addons/naming.py | Python | gpl-3.0 | 2,383 |
import tkinter as tk
from tkinter import ttk
class BindEntry():
def __init__(self, master, key, index, labelText, entity="entry"):
self.key = key
self.index = index
self.label = tk.Label(master, text=labelText)
if entity == "entry":
self.entry = tk.Entry(master, bd=5)
if entity == "box":
self.entry =... | victor-prado/broker-manager | broker-manager/BindEntry.py | Python | mit | 600 |
from sympy.printing import ccode
from scipy import integrate
from symengine import I
from sympy import *
from Numerical_CFS_Docker.configfunktion import configfunktion
from Numerical_CFS_Docker.Lib_Action_Minimum import *
import configparser
import sympy as sy
import symengine as si
import numpy as np
import random
imp... | BlackTeaAndCoffee/Causal-Fermion-System-of-Dirac-Sphere | Dockers/build/lib/Numerical_CFS_Docker/Action.py | Python | gpl-3.0 | 3,743 |
"""Unit tests for the calendar time remaining collector."""
from datetime import datetime
from .base import CalendarTestCase
class CalendarTimeRemainingTest(CalendarTestCase):
"""Unit tests for the calendar time remaining collector."""
METRIC_TYPE = "time_remaining"
async def test_time_remaining(self)... | ICTU/quality-time | components/collector/tests/source_collectors/calendar/test_time_remaining.py | Python | apache-2.0 | 847 |
#http://stackoverflow.com/questions/2368544/how-can-i-remove-a-column-from-a-sparse-matrix-efficiently
#http://stackoverflow.com/questions/4695337/expanding-adding-a-row-or-column-a-scipy-sparse-matrix
# We need a way to efficiently add/remove specific rows and columns.
class BurgenerClassifier(object):
"""
A... | chrisspen/asklet | asklet/classifier.py | Python | lgpl-3.0 | 1,457 |
# Django
from django.contrib.auth.base_user import BaseUserManager
class UserManager(BaseUserManager):
def create_user(self, email, password=None, **extra_fields):
user = self.model(email=self.normalize_email(email),
password=password,
is_active=False,
... | fga-gpp-mds/2017.2-Receituario-Medico | medical_prescription/user/models/usermanager.py | Python | mit | 885 |
from __future__ import division
import sys, os, pdb, pprint
import pylab as pl
import numpy as np
scipy = True
try:
from scipy.stats import gaussian_kde
from scipy.spatial import Delaunay
from scipy.optimize import minimize
except ImportError:
scipy = False
from barak.io import loadobj, parse_config, ... | nhmc/LAE | python_modules/run_emcee/plot_mcmc.py | Python | mit | 13,458 |
from typing import Any, Callable, Optional, TypeVar, Union, cast
import reactivex
from reactivex import Observable, abc, typing
from reactivex.disposable import CompositeDisposable
_T = TypeVar("_T")
def sample_observable(
source: Observable[_T], sampler: Observable[Any]
) -> Observable[_T]:
def subscribe(
... | ReactiveX/RxPY | reactivex/operators/_sample.py | Python | mit | 2,123 |
"""
Module to interact with public github API (https://developer.github.com/guides/getting-started/)
"""
import requests
# For disabling the InsecurePlatForm warnings (arises when using requests in python 2.x)
import requests.packages.urllib3
requests.packages.urllib3.disable_warnings()
class Repository(object):
... | Demfier/GitPub | build/lib/gitpub/gitpub.py | Python | mit | 6,511 |
#!/usr/bin/env python
"""Kit class module."""
from celery import Celery
from celery.signals import task_postrun
from celery.task import periodic_task
from flask import Flask
from flask.signals import request_tearing_down
from os.path import abspath, dirname, join
from sqlalchemy import create_engine
from sqlalchemy.... | mtth/kit | kit/base.py | Python | mit | 5,735 |
import datetime
from django.conf import settings
from django.core.exceptions import FieldError
from django.db.backends.utils import truncate_name
from django.db.models.constants import LOOKUP_SEP
from django.db.models.expressions import ExpressionNode
from django.db.models.query_utils import select_related_descend, Qu... | pylixm/sae-django-demo | django1.7-sae/site-packages/django/db/models/sql/compiler.py | Python | apache-2.0 | 51,383 |
# -*- coding: utf-8 -*-
# clf.py (c) Mikhail Mezyakov <mihail265@gmail.com>
# Released under the GNU GPL v.3
#
# Random shell commands from commandlinefu.com
import urllib
def horo(channel, user, args):
"""Get random shell command from commandlinefu.com"""
url = 'http://www.commandlinefu.com/commands/rando... | aluminiumgeek/horo-modules | net/clf.py | Python | gpl-3.0 | 587 |
# -*- coding: utf-8 -*-
import factory
import datetime
from koalixcrm.crm.models import Agreement
from koalixcrm.crm.factories.factory_resource import StandardResourceFactory
from koalixcrm.crm.factories.factory_human_resource import StandardHumanResourceFactory
from koalixcrm.crm.factories.factory_task import Standar... | dario61081/koalixcrm | koalixcrm/crm/factories/factory_agreement.py | Python | bsd-3-clause | 1,979 |
import unittest
import numpy as np
import pysal.lib
import pysal.model.spreg.diagnostics_tsls as diagnostics_tsls
import pysal.model.spreg.diagnostics as diagnostics
from pysal.model.spreg.ols import OLS as OLS
from pysal.model.spreg.twosls import TSLS as TSLS
from pysal.model.spreg.twosls_sp import GM_Lag
from scipy.s... | lixun910/pysal | pysal/model/spreg/tests/test_diagnostics_tsls.py | Python | bsd-3-clause | 2,068 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2022, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | bokeh/bokeh | bokeh/plotting/_decorators.py | Python | bsd-3-clause | 3,921 |
from __future__ import absolute_import
import six
from base64 import b64encode
from sentry.testutils import APITestCase
class AuthDetailsEndpointTest(APITestCase):
path = '/api/0/auth/'
def test_logged_in(self):
user = self.create_user('foo@example.com')
self.login_as(user)
response... | looker/sentry | tests/sentry/api/endpoints/test_auth_index.py | Python | bsd-3-clause | 2,777 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (c) 2012-2014 Ciro Mattia Gonano <ciromattia@gmail.com>
# Copyright (c) 2013-2015 Pawel Jastrzebski <pawelj@iosphe.re>
#
# Permission to use, copy, modify, and/or distribute this software for
# any purpose with or without fee is hereby granted, provided that ... | kyuzumaki/kcc | kcc.py | Python | isc | 2,672 |
from django.contrib.auth.models import AnonymousUser
from django.conf import settings
from jobs.models import job_status_levels as job_states
# Export the setting(s) we need access to in templates
def site_settings(request):
return dict(DATA_URL=settings.DATA_URL,
PRODUCTION=settings.PRODUCTION,
... | BILS/agda | agda/agda/context_processors.py | Python | mit | 1,368 |
from Components.HTMLComponent import HTMLComponent
from Components.GUIComponent import GUIComponent
from Screen import Screen
from Components.ActionMap import ActionMap
from Components.Label import Label
from ServiceReference import ServiceReference
from enigma import eListboxPythonMultiContent, eListbox, gFont, iServi... | popazerty/SDG-e2 | lib/python/Screens/ServiceInfo.py | Python | gpl-2.0 | 10,356 |
from toontown.town.TTStreet import TTStreet
class TutorialStreet(TTStreet):
def enter(self, requestStatus):
TTStreet.enter(self, requestStatus, visibilityFlag=0, arrowsOn=0)
def exit(self):
TTStreet.exit(self, visibilityFlag=0)
def enterTownBattle(self, event):
self.loader.townBa... | linktlh/Toontown-journey | toontown/town/TutorialStreet.py | Python | apache-2.0 | 637 |
#!/usr/bin/env python2
# Copyright (C) 2013:
# Gabes Jean, naparuba@gmail.com
# Pasche Sebastien, sebastien.pasche@leshop.ch
#
# 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... | AddOnline/check-linux-by-ssh | check_net_stats_by_ssh.py | Python | mit | 9,785 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 IBM Corp.
#
# 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
#
# ... | sridevikoushik31/openstack | nova/api/openstack/compute/contrib/floating_ips_bulk.py | Python | apache-2.0 | 6,035 |
# Copyright 2013-2020 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)
"""Schema for compilers.yaml configuration file.
.. literalinclude:: _spack_root/lib/spack/spack/schema/compilers.py
:... | rspavel/spack | lib/spack/spack/schema/compilers.py | Python | lgpl-2.1 | 4,140 |
# -*- coding:utf-8 -*-
#
#
# Copyright (C) 2015 Clear ICT Solutions <info@clearict.com>.
# All Rights Reserved.
#
# 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 ver... | Clear-ICT/odoo-addons | sale_tax_number_check/models/__init__.py | Python | agpl-3.0 | 829 |
from collections import defaultdict
import copy
from .elements import (ContainsClauseElement,
AlignmentClauseElement,
RightAlignedClauseElement, LeftAlignedClauseElement,
NotRightAlignedClauseElement, NotLeftAlignedClauseElement)
from .attributes im... | samihuc/PolyglotDB | polyglotdb/query/annotations/query.py | Python | mit | 14,167 |
def median(l):
if len(l) % 2 == 1:
return sorted(l)[len(l) // 2]
else:
s = sorted(l)
return (s[len(l) // 2 - 1] + s[len(l) // 2]) / 2
p = int(raw_input())
n = raw_input()
l = list(map(int, raw_input().split()))
if median(l) < p:
print 'Parie !'
else:
print 'Jockey suivant !'
| INSAlgo/codingbattle-2017 | concours/a_paris/sol/sol.2.py | Python | gpl-3.0 | 319 |
"""Account summary."""
# :license: MIT, see LICENSE for more details.
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import formatting
import click
@click.command()
@click.option('--sortby',
help='Column to sort by',
default='datacenter',
type=cli... | briancline/softlayer-python | SoftLayer/CLI/summary.py | Python | mit | 1,285 |
from openerp.osv import fields, osv
class appinstance_host(osv.osv):
_name = "appinstance.host"
appinstance_host()
class appinstance_app(osv.osv):
_name = "appinstance.app"
appinstance_app()
| galtys/galtys-addons | galtys_custom_server/appinstance.py | Python | agpl-3.0 | 202 |
fw = open('sample.txt', 'w')
fw.write('Write a first line in the text file\n')
#ich brauch das \n für den Zeilenumbruch
fw.write('I like bacon')
fw.close()
fr = open('sample.txt','r')
text = fr.read()
print(text)
fr.close()
| eHanseJoerg/learning-machine-learning | 00 python basics/readwritefiles.py | Python | gpl-2.0 | 231 |
"""Hubs and authorities analysis of graph structure.
"""
# Copyright (C) 2008-2012 by
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pieter Swart <swart@lanl.gov>
# All rights reserved.
# BSD license.
# NetworkX:http://networkx.github.io/
import networkx as nx
from networkx.... | ltiao/networkx | networkx/algorithms/link_analysis/hits_alg.py | Python | bsd-3-clause | 9,424 |
"""
Given a set of validation predictions, this script computes the optimal linear weights on the validation set.
It computes the weighted blend of test predictions, where some models are replaced by their bagged versions.
"""
import os
import numpy as np
import sys
import theano
import theano.tensor as T
import scip... | yejingxin/kaggle-ndsb | ensemble_predictions.py | Python | mit | 3,824 |
import pytest
import numpy as np
import pandas as pd
from pandas.util.testing import assert_frame_equal
import fishact
def test_sleep_latency():
df = pd.DataFrame({'zeit': np.linspace(0.0, 19.0, 20),
'sleep': np.ones(20, dtype=int)})
assert np.isnan(fishact.summarize._sleep_latency(d... | justinbois/fish-activity | tests/test_summarize.py | Python | mit | 4,743 |
class BufferFullException(Exception):
pass
class BufferEmptyException(Exception):
pass
class CircularBuffer(object):
def __init__(self):
pass
| rootulp/xpython | exercises/circular-buffer/circular_buffer.py | Python | mit | 166 |
""" Build tool that finds dependencies automatically for any language.
fabricate is a build tool that finds dependencies automatically for any
language. It's small and just works. No hidden stuff behind your back. It was
inspired by Bill McCloskey's make replacement, memoize, but fabricate works on
Windows as well as ... | josephwecker/zml | code/tools/fabricate.py | Python | mit | 36,482 |
# Can be the admin or notification token
AUTH_TOKEN = 'YOUR TOKEN HERE'
# Format of success/failure response
FORMAT = 'json' # or xml
# Room to send message
ROOM_ID = 12345
# Name of sender
SENDER = 'JabberBot'
# Color of message background
COLOR = 'purple' # yellow, red, green, purple, gray, or random
| stoneG/jabber | sample_conf.py | Python | mit | 308 |
#!/usr/bin/python
#coding=utf-8
'''
@author: sheng
@contact: sinotradition@gmail.com
@copyright: License according to the project license.
'''
NAME='SnakeDeep'
SEPLL='shé'
CN='蛇'
SEQ='6'
if __name__=='__main__':
pass
| sinotradition/sinoera | sinoera/sinozodiac/snakedeep.py | Python | apache-2.0 | 224 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "GITSdb_NEW.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| jannainm/CS532GITSProject | Program_Files/GITSdb_NEW/manage.py | Python | gpl-3.0 | 253 |
import re
from comics.aggregator.crawler import CrawlerBase, CrawlerImage
from comics.core.comic_data import ComicDataBase
class ComicData(ComicDataBase):
name = 'Virtual Shackles'
language = 'en'
url = 'http://www.virtualshackles.com/'
start_date = '2009-03-27'
end_date = '2014-02-15'
active... | datagutten/comics | comics/comics/virtualshackles.py | Python | agpl-3.0 | 474 |
#!/usr/bin/env python
import sys
if __name__=='__main__':
for line in sys.stdin:
line = line.strip().split(',')
key = '%s%s' % (line[1],line[2])
usr = line[0]
print '%s\t%s' % (usr,key)
| plagree/TOPKS | dbscripts/similarity/dt_num_mapper.py | Python | gpl-3.0 | 224 |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | ghchinoy/tensorflow | tensorflow/python/util/serialization_test.py | Python | apache-2.0 | 2,724 |
import traceback
from bs4 import BeautifulSoup
from couchpotato.core.helpers.encoding import toUnicode
from couchpotato.core.helpers.variable import tryInt
from couchpotato.core.logger import CPLog
from couchpotato.core.media._base.providers.torrent.base import TorrentProvider
log = CPLog(__name__)
class Base(Torr... | Affix/CouchPotatoServer | couchpotato/core/media/_base/providers/torrent/sceneaccess.py | Python | gpl-3.0 | 5,699 |
"""
Sysconfig - files in ``/etc/sysconfig/``
========================================
This is a collection of parsers that all deal with the system's configuration
files under the ``/etc/sysconfig/`` folder. Parsers included in this module
are:
ChronydSysconfig - file ``/etc/sysconfig/chronyd``
---------------------... | wcmitchell/insights-core | insights/parsers/sysconfig.py | Python | apache-2.0 | 7,321 |
# coding=UTF-8
#
# Copyright (C) 2015 Michell Stuttgart
# 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.
# This progra... | danieltex/pynocchio-comic-reader | src/preference.py | Python | gpl-3.0 | 1,173 |
default_app_config = 'proso_common.apps.AppConfig'
| adaptive-learning/proso-apps | proso_common/__init__.py | Python | mit | 51 |
import hashlib
from django.views.decorators.http import condition
from django.views.generic import ListView, DetailView
from django.utils.decorators import method_decorator
from .models import Post
def latest_post(request, *args, **kwargs):
return Post.objects.latest().modified_on
def get_etag(request, *args,... | DemocracyClub/django-hermes | hermes/views.py | Python | mit | 1,864 |
# hey, Python: encoding: utf-8
from twisted.words.protocols.jabber.xmlstream import NS_STREAMS
from gabbletest import XmppAuthenticator
from base64 import b64decode, b64encode
from twisted.words.xish import domish
import constants as cs
import ns
from servicetest import (ProxyWrapper, EventPattern, assertEquals,
... | mlundblad/telepathy-gabble | tests/twisted/sasl/saslutil.py | Python | lgpl-2.1 | 5,861 |
# Copyright (C) 2016 Deloitte Argentina.
# This file is part of CodexGigas - https://github.com/codexgigassys/
# See the file 'LICENSE' for copying permission.
import pathmagic
import math
import traceback
import logging
from db_pool import *
from Utils.ProcessDate import process_date
import datetime
from Utils.test im... | codexgigassys/codex-backend | src/MetaControl/MetaController.py | Python | mit | 5,569 |
import types
import unittest
import warnings
import tables
from mock import MagicMock, Mock, call, patch, sentinel
from sapphire import storage
from sapphire.simulations.base import BaseSimulation
class BaseSimulationTest(unittest.TestCase):
@patch.object(BaseSimulation, '_prepare_output_tables')
def setU... | HiSPARC/sapphire | sapphire/tests/simulations/test_base_simulation.py | Python | gpl-3.0 | 11,450 |
#!/usr/bin/env python
from localization_utils import *
import argparse
VALUE_PLACEHOLDER = "XXX"
def parse_args():
""" Parses the arguments given in the command line
Returns:
args: The configured arguments will be attributes of the returned object.
"""
parser = argparse.ArgumentParser(
... | joytunes/JTLocalize | localization_flow/jtlocalize/core/localization_diff.py | Python | mit | 4,318 |
from django.apps import AppConfig
class PeriodicalsConfig(AppConfig):
name = 'periodicals'
| kingsdigitallab/mpol-django | periodicals/apps.py | Python | mit | 97 |
import datetime
import time
class CommandException(Exception):
pass
class ParsingException(CommandException):
def __init__(self, message=None, parser=None):
super(ParsingException, self).__init__(message)
self.parser = parser
def __repr__(self):
return u"{}".format(self.message... | Radagast-red/golem | golem/interface/exceptions.py | Python | gpl-3.0 | 794 |
# Authors:
# Petr Viktorin <pviktori@redhat.com>
#
# Copyright (C) 2013 Red Hat
# see file 'COPYING' for use and warranty information
#
# 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 ... | tbabej/freeipa | ipatests/test_integration/tasks.py | Python | gpl-3.0 | 39,324 |
# Copyright 2014-2016 Presslabs SRL
#
# 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 wri... | PressLabs/gitfs | tests/cache/test_commits.py | Python | apache-2.0 | 2,086 |
# The MIT License (MIT)
#
# Copyright (c) 2017 Scott Shawcroft for Adafruit Industries.
#
# 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... | fhelje/CollectSens | src/sensors/adafruit_mcp9808.py | Python | mit | 3,693 |
from . import test_put
from . import test_stock_location
from . import test_tray_type
| OCA/stock-logistics-warehouse | stock_vertical_lift_storage_type/tests/__init__.py | Python | agpl-3.0 | 86 |
# This file was created automatically by SWIG 1.3.29.
# Don't modify this file, modify the SWIG interface instead.
"""
The `StyledTextCtrl` provides a text editor that can used as a syntax
highlighting source code editor, or similar. Lexers for several programming
languages are built-in.
"""
import _stc
import new
n... | garrettcap/Bulletproof-Backup | wx/stc.py | Python | gpl-2.0 | 262,083 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim: set et sw=4 fenc=utf-8:
#
# Copyright 2016 INVITE Communications Co., Ltd. All Rights Reserved.
#
# 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 Founda... | invitecomm/asterisk-ivr | pigeonhole/quickdemo.py | Python | gpl-3.0 | 4,933 |
import subprocess
import os.path
import re
import argparse
import sys
from pybedtools import BedTool
DEBUG = False
parser = argparse.ArgumentParser(description="find overlap gene.",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
if not DEBUG:
parser.add_argument('-i', '--i... | shengqh/ngsperl | lib/Annotation/findOverlapGene.py | Python | apache-2.0 | 1,368 |
# -*- coding: utf-8 -*-
"""
Package supporting MIL (Model-In-the-Loop) operations.
---
type:
python_module
validation_level:
v00_minimum
protection:
k00_public
copyright:
"Copyright 2016 High Integrity Artificial Intelligence Systems"
license:
"Licensed under the Apache License, Version 2.0 (th... | wtpayne/hiai | a3_src/h20_capability/runtime/mil/__init__.py | Python | apache-2.0 | 901 |
#
# 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... | mistercrunch/airflow | airflow/providers/google/cloud/hooks/pubsub.py | Python | apache-2.0 | 28,967 |
#!/usr/bin/env python
from setuptools import setup
install_requires = [
"redis==2.10.3",
"multiprocessing_logging",
]
setup(
name='pytchfork',
version='0.0.2',
description='multiprocessing decorator with queue management & redis features',
author='Shaun Viguerie',
author_email='shaunvig11... | shaunvxc/pytchfork | setup.py | Python | mit | 485 |
from route53.exceptions import Route53Error
class ChangeSet(object):
"""
These objects are used behind-the-scenes to change ResourceRecordSets
via the Route53 API.
"""
def __init__(self, connection, hosted_zone_id):
"""
:param Route53Connection connection: The connection instance b... | jcastillocano/python-route53 | route53/change_set.py | Python | mit | 1,287 |
import test_compat # pylint: disable=unused-import
from six.moves.mock import Mock, patch, PropertyMock, sentinel # pylint: disable=no-name-in-module,import-error
import os
import six
import unittest
from blivet.actionlist import ActionList
from blivet.errors import DeviceTreeError, DuplicateUUIDError, InvalidMulti... | jkonecny12/blivet | tests/devicetree_test.py | Python | lgpl-2.1 | 21,197 |
# encoding: utf-8
'''Tests for the ckanext.example_iauthfunctions extension.
'''
from ckan.common import config
import webtest
import ckan.model as model
import ckan.tests.legacy as tests
import ckan.plugins
import ckan.tests.factories as factories
import ckan.tests.helpers as helpers
from ckanext.example_iresource... | NicoVarg99/daf-recipes | ckan/ckan/ckan/ckanext/example_iresourcecontroller/tests/test_example_iresourcecontroller.py | Python | gpl-3.0 | 5,094 |
#!/usr/bin/env python
from distutils.core import setup
setup(name='pygraylog',
version='0.3.2',
description='Graylog API wrapper for python',
author='Zack Allen',
author_email='zma4580@gmail.com',
url='https://www.github.com/zmallen/pygraylog',
download_url='https://github.com/zmal... | zmallen/pygraylog | setup.py | Python | apache-2.0 | 500 |
# -*- coding: utf-8 -*-
from geokrety_api_models import User
from .base import BaseResponse
from .collections import BaseCollectionResponse
class BadgeResponse(BaseResponse):
@property
def filename(self):
return self.get_attribute('filename')
@property
def upload_url(self):
return ... | kumy/geokrety-api | tests/unittests/utils/responses/badge.py | Python | gpl-3.0 | 2,265 |
from django.shortcuts import render
def home(request):
return render(request, 'base.html') | katiayn/django-tasks-report | django_tasks_report/core/views.py | Python | gpl-2.0 | 96 |
import sqlite3
import task
import os
import datetime
class Database(object):
def __init__(self):
"""
Constructor, create a connection
"""
self.conn = sqlite3.connect(os.path.join(
os.path.dirname(__file__), 'db.db'))
def load_next(self):
... | plutec/bashtask | bashtask/database.py | Python | gpl-2.0 | 2,576 |
import unittest
import numpy as np
from ..pointpattern import PointPattern
from pysal.lib.common import RTOL
class TestPointPattern(unittest.TestCase):
def setUp(self):
self.points = [[66.22, 32.54], [22.52, 22.39], [31.01, 81.21],
[9.47, 31.02], [30.78, 60.10], [75.21, 58.93],
... | lixun910/pysal | pysal/explore/pointpats/tests/test_pointpattern.py | Python | bsd-3-clause | 4,565 |
# ***************************************************************************
# * Copyright (c) 2021 Bernd Hahnebach <bernd@bimstatik.org> *
# * *
# * This file is part of the FreeCAD CAx development system. *
# * ... | sanguinariojoe/FreeCAD | src/Mod/Fem/femsolver/mystran/add_mesh.py | Python | lgpl-2.1 | 2,856 |
import time
def fib_recurs(n: int) -> int:
if n <= 1:
return 1
return fib_recurs(n - 1) + fib_recurs(n - 2)
def fib_algorithm(n: int) -> int:
fib_list = [0, 1]
for i in range(2, n + 1):
fib_list.append(fib_list[i - 1] + fib_list[i - 2])
return fib_list[n]
input_numbers = [35, 4... | varunsinghal/datastructures-algorithms | algorithmic-toolbox/week-2/fibonacci_number_lecture.py | Python | mit | 783 |
#!/usr/bin/env python
from circuits.web import Controller
from .helpers import urlopen
class Root(Controller):
def index(self):
yield "Hello "
yield "World!"
def test(webapp):
f = urlopen(webapp.server.http.base)
s = f.read()
assert s == b"Hello World!"
| treemo/circuits | tests/web/test_yield.py | Python | mit | 293 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.