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 |
|---|---|---|---|---|---|
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 Cloudscaling Group, 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/LI... | ntt-sic/cinder | cinder/openstack/common/rpc/matchmaker.py | Python | apache-2.0 | 12,220 |
#!/usr/bin/env python3
import socket
def netcat(hostname, port, content):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((hostname, port))
s.sendall(content)
s.shutdown(socket.SHUT_WR)
while 1:
data = s.recv(1024)
if data == "":
break
print "Rece... | nikatjef/python-zabbix | zabbix/zabbix/tools/netcat.py | Python | lgpl-2.1 | 385 |
import demo_init
import json
try:
import readline
except:
pass
from time import time
db = demo_init.get_db()
import os
# Execute queries
queries = os.listdir("queries")
for query in queries:
print "Query " + query + ":"
with open("queries/" + query) as f:
qstr = f.read()
print qstr
... | danieltahara/sinew | benchmark/system/argo/test.py | Python | mit | 555 |
import socket, _thread, tkinter as tk, tkinter.ttk as ttk
from time import strftime, sleep
from tkinter import messagebox, simpledialog
#===========================================================================#
class BasicInputDialog:
def __init__(self,question,title=None,hideWindow=True):
if title == ... | Griffiths117/TG-s-IRC | client/IRClient.py | Python | mit | 4,985 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-02-12 19:03
from __future__ import unicode_literals
from querybuilder.tests.utils import get_postgres_version
# These migrations should only be run during tests and not in your installed app.
try:
if get_postgres_version() < (9, 4):
raise ImportE... | ambitioninc/django-query-builder | querybuilder/tests/migrations/0001_initial.py | Python | mit | 3,519 |
# -*- coding: utf-8 -*-
'''
Production Configurations
- Use djangosecure
- Use Amazon's S3 for storing static files and uploaded media
- Use mailgun to send emails
- Use MEMCACHIER on Heroku
'''
from __future__ import absolute_import, unicode_literals
from boto.s3.connection import OrdinaryCallingFormat
from django.... | Nene-Padi/cookiecutter-django | {{cookiecutter.repo_name}}/config/settings/production.py | Python | bsd-3-clause | 5,513 |
# Corresponds to a small subset of scipy.special.specfun
# that has features that were ported manually from fwrap
# to f2py.
# It was assumed that SciPy 0.7.0 shipped with Ubuntu Lucid
# (using f2py) returned the correct values.
#
import numpy as np
from numpy import array, isnan, r_, arange, finfo, pi, sin, cos, ta... | jasonmccampbell/scipy-refactor | scipy/special/tests/test_specfun.py | Python | bsd-3-clause | 3,683 |
import keras
from keras.applications.resnet50 import ResNet50
def get_model(shape):
model = ResNet50(weights=None)
optimizer = keras.optimizers.Adam()
model.compile(loss='categorical_crossentropy', optimizer=optimizer, metrics=["accuracy"])
return model
| undertherain/benchmarker | benchmarker/kernels/resnet50/_keras.py | Python | mpl-2.0 | 272 |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | luotao1/Paddle | python/paddle/fluid/tests/unittests/test_fused_elemwise_activation_op.py | Python | apache-2.0 | 16,906 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
doBuildVRT.py
---------------------
Date : June 2010
Copyright : (C) 2010 by Giuseppe Sucameli
Email : brush dot tyler at gmail dot com
*****************... | carolinux/QGIS | python/plugins/GdalTools/tools/doBuildVRT.py | Python | gpl-2.0 | 7,891 |
#This file is part of Tryton. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
"Interfaces"
class ParserInterface(object):
def __init__(self, parent=None, attrs=None, screen=None,
children_field=None):
self.parent = parent
... | mediafactory/tryton_client_desktop | tryton/gui/window/view_form/view/interface.py | Python | gpl-3.0 | 1,111 |
# -*- coding: utf-8 -*-
"""svn tests"""
import io
import os
import subprocess
import sys
import unittest
from setuptools.tests import environment
from setuptools.compat import unicode, unichr
from setuptools import svn_utils
from setuptools.tests.py26compat import skipIf
def _do_svn_check():
try:
subpro... | cortext/crawtextV2 | ~/venvs/crawler/lib/python2.7/site-packages/setuptools/tests/test_svn.py | Python | mit | 7,806 |
import unittest
from arc_utilities.conversions import parse_file_size
class TestConversions(unittest.TestCase):
def test_parse_file_size(self):
self.assertEqual(parse_file_size('1'), 1)
self.assertEqual(parse_file_size('12.2'), 12)
self.assertEqual(parse_file_size('1k'), 1_000)
s... | UM-ARM-Lab/arc_utilities | tests/test_conversions.py | Python | bsd-2-clause | 681 |
#!/usr/bin/env python
"""Tests of code for OTU picking"""
__author__ = "Kyle Bittinger, Greg Caporaso"
__copyright__ = "Copyright 2011, The QIIME Project"
# remember to add yourself if you make changes
__credits__ = [
"Kyle Bittinger",
"Greg Caporaso",
"Rob Knight",
"Jens Reeder",
"William Walters... | wasade/qiime | tests/test_pick_otus.py | Python | gpl-2.0 | 215,397 |
import gc
def queryset_iterator(queryset, chunksize=1000):
'''
Iterate over a Django Queryset ordered by the primary key
This method loads a maximum of chunksize (default: 1000) rows in it's
memory at the same time while Django normally would load all rows in it's
memory. Using the iterator() meth... | citationfinder/scholarly_citation_finder | scholarly_citation_finder/lib/django.py | Python | mit | 771 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013 GNS3 Technologies 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.
... | GNS3/gns3-server | gns3server/compute/dynamips/nios/nio_generic_ethernet.py | Python | gpl-3.0 | 2,109 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from gaecookie.decorator import no_csrf
from gaepermission.decorator import login_not_required, permissions, login_required
from config.template_middleware import TemplateResponse
from permission_app.model import ADMIN
from tekton import r... | onlylia/aulaScripts | tekton-master/backend/appengine/routes/admin/home.py | Python | mit | 822 |
#
# Copyright (c) 2013-2018 Quarkslab.
# This file is part of IRMA project.
#
# 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 in the top-level directory
# of this distribution and at:
#
# http:... | quarkslab/irma | frontend/api/files/schemas.py | Python | apache-2.0 | 957 |
"""
:codeauthor: Thomas Stoner <tmstoner@cisco.com>
"""
# Copyright (c) 2018 Cisco and/or its affiliates.
#
# 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/li... | saltstack/salt | tests/unit/modules/nxos/nxos_n95k.py | Python | apache-2.0 | 15,225 |
"""Sensors for the Elexa Guardian integration."""
from __future__ import annotations
from typing import Callable
from homeassistant.components.sensor import SensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
DEVICE_CLASS_BATTERY,
DEVICE_CLASS_TEMPERATURE,
P... | w1ll1am23/home-assistant | homeassistant/components/guardian/sensor.py | Python | apache-2.0 | 6,664 |
#!/usr/bin/python
import argparse
from board_manager import BoardManager
from constants import *
def main():
parser = argparse.ArgumentParser(description='Board client settings')
parser.add_argument('-sp', '--PORT', help='server port', type=int,
default=80, required=False)
parser.... | TeamProxima/predictive-fault-tracker | board/board_client.py | Python | mit | 909 |
from fauxquests.session import FauxServer
| lukesneeringer/fauxquests | fauxquests/__init__.py | Python | bsd-3-clause | 42 |
#!/usr/bin/python
# Author= Timo Fischer
import sys
import getopt
from CsvFile import CsvFile
from JsonFile import JsonFile
def main(argv):
inputfile = ''
outputfile = ''
try:
opts, args = getopt.getopt(argv, "hi:o:", ["ifile=", "ofile="])
except getopt.GetoptError:
sys.stderr.write(... | timof1996/CsvToJson | main.py | Python | mit | 940 |
'''View interface module'''
from . import Attribute, Interface
class PartialListInterface(Interface):
'''General list view interface.'''
count = Attribute(optional=True)
data = Attribute()
def __init__(self, data, count=None):
'''Initialize.
Args:
data ([Interface | No... | SproutProject/sptoj-server | view/interface.py | Python | mit | 6,689 |
../../../../share/pyshared/duplicity/asyncscheduler.py | Alberto-Beralix/Beralix | i386-squashfs-root/usr/lib/python2.7/dist-packages/duplicity/asyncscheduler.py | Python | gpl-3.0 | 54 |
# Copyright 2022 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/gazoo-device | gazoo_device/tests/unit_tests/utils/dli_powerswitch_logs.py | Python | apache-2.0 | 1,345 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2018, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | rhyolight/nupic.research | tests/frameworks/pytorch/k_winners_cnn_test.py | Python | gpl-3.0 | 7,798 |
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import mpl_toolkits.mplot3d.art3d as art3d
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.patches import Wedge, Circle, PathPatch, FancyArrowPatch
from mpl_toolkits.mplot3d import proj3d
fig = plt.figure()
ax = fig.gca(projection='3d... | marcosoldati/helio-coordinate-converter | scripts/hcc.py | Python | lgpl-3.0 | 2,102 |
#!/usr/bin/env python3
import sys
import os
import shutil
import smtplib
import subprocess
import tkinter
from PIL import Image, ImageOps
from tkinter import filedialog
class Filez:
@staticmethod
def openfiles():
root = tkinter.Tk()
root.withdraw()
listoffiles = filedia... | drf24/labutils | utils-github.py | Python | gpl-3.0 | 10,572 |
# 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 applicab... | jiaphuan/models | research/deeplab/utils/get_dataset_colormap_test.py | Python | apache-2.0 | 3,056 |
from __future__ import with_statement
import pickle, warnings
from datetime import datetime, timedelta
from django.db import models
from django.db.models.fields import FieldDoesNotExist
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
from django.contrib.contenttypes.models i... | coagulant/django-model-utils | model_utils/tests/tests.py | Python | bsd-3-clause | 20,172 |
#!/usr/bin/env python
#
# Author: Dennis Stam
# Date : 6th of September 2012
#
# Tested with Python 2.5, 2.6, 2.7 (should work for 3.0, 3.1, 3.2)
# sara_nodes uses the module argparse
## The documenation, is shown when you type --help
HELP_DESCRIPTION = '''This program is a great example what you can achieve with t... | ehiggs/pbs-python | examples/sara_nodes.py | Python | gpl-3.0 | 24,504 |
<<<<<<< HEAD
<<<<<<< HEAD
"""Tests for scripts in the Tools directory.
This file contains regression tests for some of the scripts found in the
Tools directory of a Python checkout or tarball, such as reindent.py.
"""
import os
import unittest
from test.script_helper import assert_python_ok
from test.test_tools impo... | ArcherSys/ArcherSys | Scripts/Lib/test/test_tools/test_reindent.py | Python | mit | 2,270 |
import unittest
import portalpy
class TestInvitations(unittest.TestCase):
portalUrl = "https://portalpy.esri.com/arcgis"
agolUrl = "https://arcgis.com"
portalAdminName = "portaladmin"
portalAdminPassword = "portaladmin"
def setUp(self):
self.portal = portal... | aayushkr/portalpy | tests/TestInvitations.py | Python | apache-2.0 | 1,350 |
class Calc:
# need self.
# occur below
# typeError: add() takes exactly 2 arguments (3 given)
def add(self, x, y):
if not isinstance(x, int):
raise TypeError("%r: integer expected" % (x))
if not isinstance(y, int):
raise TypeError("%r: integer expected" % (y))
... | vottie/lang | python/calc/calc.py | Python | mit | 341 |
import pandas as pd
import glob as glob
# **Introduction**
# Fredrik Ahlgren
#
# The dataset from MS Birka Stockholm is in .xls Excel-97 format.
# And the data was gathered in several steps during three different trips.
# Some of the data is overlapping in time-index, and same headers (data points) exist in several fi... | francescobaldi86/Ecos2015PaperExtension | Data_Process/create_birka_database_1y.py | Python | mit | 4,464 |
# -*- coding: utf-8 -*-
"""
End-to-end tests for the courseware unit bookmarks.
"""
import json
from unittest import skip
import pytest
import requests
from common.test.acceptance.fixtures.course import CourseFixture, XBlockFixtureDesc
from common.test.acceptance.pages.common import BASE_URL
from common.test.acceptan... | a-parhom/edx-platform | common/test/acceptance/tests/lms/test_bookmarks.py | Python | agpl-3.0 | 22,195 |
from __future__ import unicode_literals
from future.builtins import int, range, str
from datetime import date, datetime
from os.path import join, split
from uuid import uuid4
import django
from django import forms
from django.forms.extras import SelectDateWidget
from django.core.files.storage import FileSystemStorage... | JostCrow/django-forms-builder | forms_builder/forms/forms.py | Python | bsd-2-clause | 19,092 |
# 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... | sxjscience/tvm | tests/python/relay/test_pass_context_analysis.py | Python | apache-2.0 | 7,635 |
"""
Twisted Spread Interfaces.
This module is unused so far. It's also undecided whether this module
will remain monolithic.
"""
from zope.interface import Interface
class IJellyable(Interface):
def jellyFor(jellier):
"""
Jelly myself for jellier.
"""
class IUnjellyable(Interface):
d... | mzdaniel/oh-mainline | vendor/packages/twisted/twisted/spread/interfaces.py | Python | agpl-3.0 | 705 |
import sys
import re
from email.utils import parseaddr
from sqlalchemy import not_, func
from datetime import datetime
from time import gmtime, strftime
from pyramid.view import (
view_config,
)
from pyramid.httpexceptions import (
HTTPFound,
)
import colander
from deform import (
Form,
widget,
... | aagusti/e-sipkd | esipkd_ori_17012017/views/arstsitem.py | Python | lgpl-3.0 | 8,166 |
#!/usr/bin/python
from pisi.actionsapi import shelltools, get, autotools, pisitools
def setup():
autotools.configure("--disable-static")
def build():
autotools.make()
def install():
autotools.install()
pisitools.dodoc("ChangeLog", "COPYING", "README")
| richard-fisher/repository | office/libpaper/actions.py | Python | gpl-2.0 | 275 |
from test_app.tests import * | ui/django-cached_authentication_middleware | test_project/test_app_custom_user/tests.py | Python | mit | 28 |
# -*- coding: utf-8 -*-
'''
Production Configurations
- Use djangosecure
- Use Amazon's S3 for storing static files and uploaded media
- Use sendgrid to send emails
- Use MEMCACHIER on Heroku
'''
from configurations import values
# See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings... | tpugsley/tco2 | tco2/config/production.py | Python | bsd-3-clause | 4,340 |
import json
from collections import namedtuple
data = None
with open("config/config.json") as config_data:
config_data = json.load(config_data, object_hook=lambda d: namedtuple('X', d.keys())(*d.values()))
with open("config/creds.json") as creds_data:
creds = json.load(creds_data, object_hook=lambda ... | sebj/r-CompetitiveOverwatch-Bot | config/__init__.py | Python | mit | 412 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2015-2018 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in ... | chipaca/snapcraft | tests/unit/project/test_project_info.py | Python | gpl-3.0 | 8,687 |
'''CTS: Cluster Testing System: Tests module
There are a few things we want to do here:
'''
__copyright__ = '''
Copyright (C) 2000, 2001 Alan Robertson <alanr@unix.sh>
Licensed under the GNU GPL.
Add RecourceRecover testcase Zhao Kai <zhaokai@cn.ibm.com>
'''
#
# This program is free software; you can redistribute... | aspiers/pacemaker | cts/CTStests.py | Python | gpl-2.0 | 111,282 |
#!/usr/bin/env python
# coding: utf-8
import grab
import os
import csv
import sys
import argparse
from grab.spider import Spider, Task
class ScheduleSpider(Spider):
initial_urls = ['http://www.tennislive.net/', ]
def task_initial(self, grab, task):
'''
'''
date = ''
if os.geten... | cs-hse-projects/DataSpider_Dubov | TennisSpider/Class_ScheduleSpider.py | Python | mit | 2,183 |
from __future__ import print_function
from builtins import input
from builtins import zip
from builtins import range
from builtins import object
__author__="Ning Guo, ceguo@connect.ust.hk"
__supervisor__="Jidong Zhao, jzhao@ust.hk"
__institution__="The Hong Kong University of Science and Technology"
""" 2D model for m... | yade/trunk | py/FEMxDEM/msFEMup.py | Python | gpl-2.0 | 12,066 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2008 Brian G. Matherly
# Copyright (C) 2008 Jerome Rapinat
# Copyright (C) 2008 Benny Malengier
# Copyright (C) 2010 Gary Burton - derived from _HasGalleryBase.py
#
# This program is free software; you can redistribute it and/or modify
# it under t... | Forage/Gramps | gramps/gen/filters/rules/source/_hasrepository.py | Python | gpl-2.0 | 2,676 |
__author__ = 'nicococo'
import numpy as np
class ClusterSvdd:
""" Implementation of the cluster support vector data description (ClusterSVDD).
Author: Nico Goernitz, TU Berlin, 2015
"""
PRECISION = 1e-4 # This parameter can be important as it effects the threshold,
# support... | nicococo/ClusterSvdd | ClusterSVDD/cluster_svdd.py | Python | mit | 3,055 |
#!/usr/bin/env python
# -*- coding: utf-8; tab-width: 4; indent-tabs-mode: t -*-
#
# NetProfile: Authentication routines
# © Copyright 2013-2014 Alex 'Unik' Unigovsky
#
# This file is part of NetProfile.
# NetProfile is free software: you can redistribute it and/or
# modify it under the terms of the GNU Affero General ... | annndrey/npui-unik | netprofile/netprofile/common/auth.py | Python | agpl-3.0 | 6,265 |
"""Function helpers.
"""
import numpy as np
from astropy.coordinates import matrix_utilities
from astropy.time import Time
def circular_velocity(k, a):
"""Compute circular velocity for a given body (k) and semimajor axis (a).
"""
return np.sqrt(k / a)
def rotate(vector, angle, axis='z', unit=None):
... | anhiga/poliastro | src/poliastro/util.py | Python | mit | 3,081 |
#!/usr/bin/python
import os, sys, subprocess, logging
from options import SIXAnalyzer_options
from rules import SIXAnalyzer_rules
class SIXAnalyzer_files():
@staticmethod
def get_files():
return (SIXAnalyzer_files.files)
@staticmethod
def get_header_files():
return (SIXAnalyzer_files... | Sixdsn/CppAnalyzer | modules/files.py | Python | mpl-2.0 | 1,896 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4 nu
from __future__ import (unicode_literals, absolute_import,
division, print_function)
import datetime
import reversion
from py3compat import implements_to_string
from django.db import models
from django.dispatch impor... | yeleman/snisi | snisi_epidemiology/models.py | Python | mit | 14,811 |
# -*- coding: utf-8 -*-
import logging
CONFIG = None #installed on startup
USER_STATUS_GUEST = -1 #People who aren't logged in
USER_STATUS_PENDING = 0
USER_STATUS_ACTIVE = 1
USER_STATUS_BANNED = 2
USER_STATUS_MODERATOR = 3
USER_STATUS_ADMINISTRATOR = 4
USER_STATUS_NAMES = {
USER_STATUS_GUEST: 'guest',
USER_ST... | IrealiTY/ffxiv-market | ffxiv_market/common.py | Python | gpl-3.0 | 851 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2009-Today OpenERP SA (<http://www.openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms ... | iw3hxn/LibrERP | show_pickings_on_purchase_orders/__openerp__.py | Python | agpl-3.0 | 1,412 |
# Copyright (C) 2010 Wil Mahan <wmahan+fatics@gmail.com>
#
# This file is part of FatICS.
#
# FatICS 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 License, or
# (at your optio... | ecolitan/fatics | src/command/__init__.py | Python | agpl-3.0 | 1,233 |
# **********************************************************************
#
# Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
#
# This copy of Ice is licensed to you under the terms described in the
# ICE_LICENSE file included in this distribution.
#
# ***********************************************************... | ljx0305/ice | python/test/Ice/adapterDeactivation/AllTests.py | Python | gpl-2.0 | 2,229 |
'''
This provides the view functions for the /api/keywords endpoints
'''
import flask
from flask import current_app
from robot.libdocpkg.htmlwriter import DocToHtml
class ApiEndpoint(object):
def __init__(self, blueprint):
blueprint.add_url_rule("/keywords/", view_func = self.get_keywords)
def get_ke... | stefanzweig/rfbench | rfbench/blueprints/api/keywords.py | Python | gpl-3.0 | 563 |
from hazelcast.serialization.bits import *
from hazelcast.protocol.builtin import FixSizedTypesCodec
from hazelcast.protocol.client_message import OutboundMessage, REQUEST_HEADER_SIZE, create_initial_buffer, RESPONSE_HEADER_SIZE
from hazelcast.protocol.codec.custom.raft_group_id_codec import RaftGroupIdCodec
from hazel... | hazelcast/hazelcast-python-client | hazelcast/protocol/codec/atomic_long_get_and_set_codec.py | Python | apache-2.0 | 1,118 |
from django.db import models
class Article(models.Model):
"""
A simple Article model for testing
"""
site = models.ForeignKey('sites.Site', related_name="admin_articles")
title = models.CharField(max_length=100)
title2 = models.CharField(max_length=100, verbose_name="another name")
create... | Smarsh/django | tests/regressiontests/admin_util/models.py | Python | bsd-3-clause | 624 |
# func multiply(m, n)
# if len(m) == 1 or len(n) == 1:
# return m * n
# k = 2 * (max(len(m), len(n)) / 2 + 1 )
# a = m / 10 ** k
# b = m % 10 ** k
# c = n / 10 ** k
# d = n % 10 ** k
# ac = multiply(a, c)
# bd = multiply(b, d)
# mid = multiply(a+b, c+d) - ac -bd
# return ac * 10 ** k + mid * 10 *... | adiultra/pysick | learn/algo/karastuba.py | Python | gpl-3.0 | 882 |
from SimPEG import *
import simpegEM as EM
from pymatsolver import MumpsSolver
from Rules import RememberXC
cs, ncx, ncy, ncz, npad = 20., 30, 20, 30, 12
hx = [(cs,npad,-1.4), (cs,ncx), (cs,npad,1.4)]
hy = [(cs,npad,-1.4), (cs,ncy), (cs,npad,1.4)]
hz = [(cs,npad,-1.4), (cs,ncz), (cs,npad,1.4)]
mesh = Mesh.TensorMesh([... | sgkang/AGU2014MovingDimensionsinEM | codes/HydroInv_FD.py | Python | mit | 2,720 |
from .encoder_sample import *
from .itq_encoder import *
from .pq_encoder import *
| kogaki/pqkmeans | pqkmeans/encoder/__init__.py | Python | mit | 83 |
import logging
import re
import unicodecsv
import xlrd
from openelex.base.load import BaseLoader
from openelex.lib.text import ocd_type_id
from openelex.models import RawResult
from openelex.us.ia.datasource import Datasource
class LoadResults(object):
"""
Entry point for data loading.
Determines appro... | cathydeng/openelections-core | openelex/us/ia/load.py | Python | mit | 77,550 |
'''insightstests.py - list insights settings for each Azure resource group'''
import json
import sys
import azurerm
def main():
'''Main routine.'''
# Load Azure app defaults
try:
with open('azurermconfig.json') as config_file:
config_data = json.load(config_file)
except FileNotFoun... | gbowerman/azurerm | examples/insightstests.py | Python | mit | 1,350 |
"""
Copyright (C) 2016 Interactive Brokers LLC. All rights reserved. This code is
subject to the terms and conditions of the IB API Non-Commercial License or the
IB API Commercial License, as applicable.
"""
"""
The known server versions.
"""
#MIN_SERVER_VER_REAL_TIME_BARS = 34
#MIN_SERVER_VER_SCALE_ORDERS ... | geome-mitbbs/QTS_Research | IB_Api/ibapi/server_versions.py | Python | mit | 3,077 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import threading
try:
# Python 3
import queue
except ImportError:
# Python 2
import Queue as queue
import tweepy.auth
from tweepy.streaming import StreamListener, Stream
from tweepy.auth impo... | jubatus/jubakit | jubakit/loader/twitter.py | Python | mit | 5,072 |
# -*- 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 'Children'
db.create_table(u'survey_children', (
(u'id', self.gf('django.db.model... | antsmc2/mics | survey/migrations/0019_auto__add_children__add_women__del_field_household_children_24_59_mont.py | Python | bsd-3-clause | 23,605 |
import json
import unittest
from pypercube.metric import Metric
from pypercube import time_utils
class TestMetric(unittest.TestCase):
def test_field_names(self):
self.assertEqual(Metric.TIME_FIELD_NAME, "time")
self.assertEqual(Metric.VALUE_FIELD_NAME, "value")
def test_load_json(self):
... | sbuss/pypercube | tests/test_metric.py | Python | bsd-3-clause | 1,746 |
import json
import os
import logging
import csv
import numpy as np
from keras.utils import np_utils
from keras.preprocessing.sequence import pad_sequences
from keras.preprocessing.text import Tokenizer
def save_extrasentence(preds, ids, opt):
ids = np.array(ids)
results = np.concatenate((np.expand_dims(ids, ax... | yanghanxy/CIAN | utils.py | Python | mit | 10,909 |
# Copyright (c) 2016 Uber Technologies, Inc.
#
# 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, publ... | uber/tchannel-python | tchannel/schemes/thrift.py | Python | mit | 7,654 |
#!/usr/bin/env python
# Linux IEEE 802.15.4 userspace tools
#
# Copyright (C) 2008, 2009 Siemens AG
#
# Written-by: Dmitry Eremin-Solenikov
# Written-by: Sergey Lapin
#
# 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... | tcheneau/linux-zigbee | test-serial/test_addr.py | Python | gpl-2.0 | 1,526 |
# -*- coding: utf-8 -*-
# OpenFisca -- A versatile microsimulation software
# By: OpenFisca Team <contact@openfisca.fr>
#
# Copyright (C) 2011, 2012, 2013, 2014, 2015 OpenFisca Team
# https://github.com/openfisca
#
# This file is part of OpenFisca.
#
# OpenFisca is free software; you can redistribute it and/or modify... | clbe/note_cgsp | openfisca_cgsp/prime_activite/prime_activite.py | Python | agpl-3.0 | 3,990 |
from direct.directnotify import DirectNotifyGlobal
from toontown.battle import BattlePlace
from direct.fsm import ClassicFSM, State
from direct.fsm import State
from direct.showbase import BulletinBoardWatcher
from pandac.PandaModules import *
from otp.distributed.TelemetryLimiter import RotationLimitToH, TLGatherAllAv... | Spiderlover/Toontown | toontown/coghq/MintInterior.py | Python | mit | 10,164 |
# Copyright (c) 2010 Eric Evans <eevans@sym-link.com>
#
# 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, m... | eevans/lumen | lumen/__init__.py | Python | mit | 6,816 |
from utils import log
import tempfile
import remote
import local
import os
class Widget(object):
''' A superclass for desklets and controls. Should not be used directly '''
def __init__(self, name, description, authors):
if type(authors) != list:
raise 'Widget class: ... | RaumZeit/gdesklets-core | shell2/control/Widget.py | Python | gpl-2.0 | 6,146 |
# -*- coding: utf-8 -*-
import click
import errno
import os
from aveuik import server
from mollusc import sh
from os import path as osp
BASE_DIR = osp.dirname(osp.dirname(osp.abspath(__file__)))
MIN_USER_WATCHES = 524288
@click.group('k')
def cli():
pass
def add_js_command(name, bin_path, before=None, after=N... | bachew/alpha | aveui/aveuik/cli.py | Python | unlicense | 1,990 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pexpect
import time
import sys
import re
import argparse
import json
from twilio.rest import TwilioRestClient
host = "https://msisdn.services.mozilla.com"
def clean_up_message_logs(client):
# clean up the previous message logs
messages = client.messages.list()
... | kreamkorokke/services-test | msisdn-gateway/e2e-test/test/control-script.py | Python | mpl-2.0 | 2,310 |
# coding=utf-8
# Copyright 2022 The Tensor2Robot 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 ... | google-research/tensor2robot | utils/train_eval_test_utils.py | Python | apache-2.0 | 5,835 |
import numpy as np
import matplotlib.pyplot as plt
from itertools import cycle
import seaborn as sns
from sklearn.model_selection import GroupShuffleSplit, GridSearchCV
from sklearn import metrics
from sklearn import preprocessing
from sklearn import multiclass
from sklearn import svm
from sklearn.ensemble import Rand... | buck06191/ABROAD | abroad/machine_learning.py | Python | mit | 9,193 |
# Copyright 2016 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... | odejesush/tensorflow | tensorflow/contrib/distributions/python/ops/special_math.py | Python | apache-2.0 | 9,369 |
# Copyright (C) 2010-2014 GRNET S.A.
#
# 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 program is distributed i... | apyrgio/synnefo | snf-astakos-app/astakos/im/activation_backends.py | Python | gpl-3.0 | 22,702 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import base_bg_uic
import res_company
| odoobgnet/addons | base_bg_uic/__init__.py | Python | lgpl-3.0 | 139 |
int_array = [2, 3, 4, 2, 3, 5, 4, 6, 4, 6, 9, 10, 9, 8, 7, 8, 10, 7]
mix_array = [2, 'a', 'l', 3, 'l', 4, 'k', 2, 3, 4, 'a', 6, 'c', 4, 'm', 6, 'm', 'k', 9, 10, 9, 8, 7, 8, 10, 7]
# scoping mistake on results.
def find_single(array):
answer = []
results = {}
for i in array:
if i in results.keys():
... | DakRomo/2017Challenges | challenge_2/python/phil-harmoniq/challenge_2.py | Python | mit | 570 |
# -*- coding: utf-8 -*-
from lxml import html
import json
import smtplib
import logging
logging.basicConfig(filename='dell-scrape.log', format='%(asctime)s %(message)s', level=logging.DEBUG)
json_config_file = 'laptop_list.json'
base_url = r'http://downloads.dell.com/published/pages/'
smtp_server = 'mailserver.somewhe... | csjunker/dell-scrape | dell-scrape.py | Python | bsd-3-clause | 3,369 |
#!/usr/bin/env python
# encoding: utf-8
import sys
import os
try:
from setuptools import setup, Extension
setup, Extension
except ImportError:
from distutils.core import setup, Extension
setup, Extension
import numpy
if sys.argv[-1] == "publish":
os.system("python setup.py sdist upload")
sy... | dfm/acor | setup.py | Python | mit | 1,186 |
# coding: utf-8
import os
#execfile('d:\zambaldi\python\_startup.py')
from msc.proc.bicrystal import BicrystalIndent
import msc.tools
def doit(gb_data, proc_path='./'):
#BicrystalIndent.CODE='DAMASK' # use current CPFEM code
#BicrystalIndent.CODE='GENMAT' # use 'historical' CPFEM code
BicrystalIndent.COD... | stabix/stabix | third_party_code/python/msc/bicrystal_indentation_model_from_MatlabGUI.py | Python | agpl-3.0 | 3,846 |
from datetime import datetime, timedelta, time
import pytz
from time import mktime
import iso8601
import re
from unidecode import unidecode
from vumi.utils import get_first_word
from vusion.const import PLUS_REGEX, ZEROS_REGEX
def get_default(kwargs, field, default_value):
return kwargs[field] if field in kwarg... | texttochange/vusion-backend | vusion/utils.py | Python | bsd-3-clause | 6,263 |
from distutils.core import setup
setup(
name='musica',
version='0.0.1',
description = 'musica is a Python tool for working with musical notations and scores.',
author = 'Anuj More',
author_email = 'anujmorex@gmail.com',
url = 'https://github.com/execat/musica',
keywords = 'music composition... | execat/musica | setup.py | Python | gpl-3.0 | 417 |
#
# @lc app=leetcode id=236 lang=python3
#
# [236] Lowest Common Ancestor of a Binary Tree
#
from helper.tree import TreeNode, create_tree_by_list, tree_traversal
# @lc code=start
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# ... | heyf/cloaked-octo-adventure | leetcode/236_lowest-common-ancestor-of-a-binary-tree.py | Python | mit | 1,184 |
import json
import sys
import traceback
from auth import Auth, User
from baseexception import BaseBarmenException
from config import Configuration
from flask import Flask, g, make_response, request
from flask.ext.httpauth import HTTPTokenAuth, HTTPBasicAuth
from flask.ext.restful import Api
from flask.ext.script impor... | emin100/barmanapi | barmanapi/app.py | Python | gpl-3.0 | 6,055 |
from twisted.python.filepath import FilePath
from datetime import datetime, timedelta
import time
from nevow.livetrial import testcase
from nevow.athena import LiveFragment, expose
from nevow import inevow
from epsilon.extime import Time
from axiom.store import Store
from axiom.item import Item
from axiom import at... | twisted/quotient | xquotient/test/livetest_inbox.py | Python | mit | 16,853 |
# Ant
#
# Copyright (c) 2012, Gustav Tiger <gustav@tiger.name>
#
# 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, m... | ddboline/Garmin-Forerunner-610-Extractor_fork | ant/base/ant.py | Python | mit | 12,100 |
def bloup(n):
for i in xrange(0,n):
print "%s pikachu lol %d soup soup" % (" "*(i%10), i)
bloup(666)
| refnil/CS_Game_Practice | test.py | Python | apache-2.0 | 121 |
#!/usr/bin/env python
"""
Installation script:
To release a new version to PyPi:
- Ensure the version is correctly set in oscar.__init__.py
- Run: python setup.py sdist upload
"""
from setuptools import setup, find_packages
import os
import sys
PROJECT_DIR = os.path.dirname(__file__)
PY3 = sys.version_info >= (3, 0)
... | eddiep1101/django-oscar | setup.py | Python | bsd-3-clause | 4,348 |
''' Convienence methods on VTK routines only '''
import director.vtkAll as vtk
import director.vtkNumpy as vnp
from director.shallowCopy import shallowCopy
import numpy as np
def thresholdPoints(polyData, arrayName, thresholdRange):
assert(polyData.GetPointData().GetArray(arrayName))
f = vtk.vtkThresholdPoin... | manuelli/director | src/python/director/filterUtils.py | Python | bsd-3-clause | 4,556 |
from data_importers.management.commands import BaseHalaroseCsvImporter
class Command(BaseHalaroseCsvImporter):
council_id = "EDN"
addresses_name = "2021-03-08T13:56:09.776816/polling_station_export-2021-03-08.csv"
stations_name = "2021-03-08T13:56:09.776816/polling_station_export-2021-03-08.csv"
elect... | DemocracyClub/UK-Polling-Stations | polling_stations/apps/data_importers/management/commands/import_eden.py | Python | bsd-3-clause | 909 |
# coding; utf-8
class Fsm(object):
def __init__(self, active_state, states=None):
self.moves_count = 0
self.side = "right"
self.attack_count = 0
self.states = states
self.active_state = active_state
def set_state(self, state):
self.active_state = state
de... | IuryAlves/pygame_demo | src/fsm.py | Python | mit | 677 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.