text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
DEFAULT_DOCKER_API_VERSION = '1.19'
DEFAULT_TIMEOUT_SECONDS = 60
STREAM_HEADER_SIZE_BYTES = 8
CONTAINER_LIMITS_KEYS = [
'memory', 'memswap', 'cpushares', 'cpusetcpus'
]
| Melraidin/docker-py | docker/constants.py | Python | apache-2.0 | 173 | 0 |
#
# This file is part of Dragonfly.
# (c) Copyright 2018 by Dane Finlay
# Licensed under the LGPL.
#
# Dragonfly is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or... | tylercal/dragonfly | dragonfly/test/test_contexts.py | Python | lgpl-3.0 | 4,426 | 0.000226 |
# standard library
from datetime import date
# third party
from braces.views import LoginRequiredMixin, AnonymousRequiredMixin
# Django
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.core.exceptions import ObjectDoesNotExist
from django.core.urlreso... | tulikavijay/vms | vms/shift/views.py | Python | gpl-2.0 | 26,821 | 0.003169 |
"""
Support for EnOcean binary sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.enocean/
"""
import logging
import voluptuous as vol
from homeassistant.components.binary_sensor import (
BinarySensorDevice, PLATFORM_SCHEMA, SENS... | xifle/home-assistant | homeassistant/components/binary_sensor/enocean.py | Python | mit | 2,747 | 0 |
#!/usr/bin/env python
import json
import unittest
import numpy as np
from math import pi
import sys
sys.path.insert(0,'../')
from pyfaunus import *
# Dictionary defining input
d = {}
d['geometry'] = { 'type': 'cuboid', 'length': 50 }
d['atomlist'] = [
{ 'Na': dict( r=2.0, eps=0.05, q=1.0, tfe=1.0 ) },
... | gitesei/faunus | examples/pythontest.py | Python | mit | 4,462 | 0.032048 |
# Copyright (c) 2011 Oregon State University Open Source Lab
#
# 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, mod... | BITalinoWorld/python-serverbit | twisted-ws/txws.py | Python | gpl-3.0 | 19,519 | 0.000768 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2012 Midokura Japan K.K.
# Copyright (C) 2013 Midokura PTE LTD
# Copyright (C) 2014 Midokura SARL.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the Licen... | midokura/python-neutron-plugin-midonet | midonet/neutron/plugin.py | Python | apache-2.0 | 35,809 | 0 |
import urllib
import xml.etree.ElementTree as ET
serviceurl = 'http://maps.googleapis.com/maps/api/geocode/xml?'
while True:
address = raw_input('Enter location: ')
if len(address) < 1 : break
url = serviceurl + urllib.urlencode({'sensor':'false', 'address': address})
print 'Retrieving', url
uh =... | johanfrisk/Python_at_web | notebooks/code/geoxml.py | Python | mit | 743 | 0.012113 |
# -*- coding: utf-8 -*-
import os
from math import factorial
import functools
def memoize(func):
cache = {}
def memoized(key):
# Returned, new, memoized version of decorated function
if key not in cache:
cache[key] = func(key)
return cache[key]
return functools.updat... | NicovincX2/Python-3.5 | Algorithmique/Mathématiques discrètes/Combinatoire/Nombre de Catalan/nb_catalan_3methods.py | Python | gpl-3.0 | 1,091 | 0 |
# Copyright (c) 2011 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 ... | orbitfp7/nova | nova/scheduler/filter_scheduler.py | Python | apache-2.0 | 7,412 | 0.00027 |
from django.utils.translation import ugettext as _, ugettext_lazy as _lazy
from django.core import urlresolvers
from gasistafelice.rest.views.blocks.base import BlockSSDataTables, ResourceBlockAction, CREATE_PDF, SENDME_PDF
from gasistafelice.consts import EDIT, CONFIRM
from gasistafelice.lib.shortcuts import render_... | matteo88/gasistafelice | gasistafelice/rest/views/blocks/basket.py | Python | agpl-3.0 | 8,830 | 0.013024 |
# Breadth-first Search
#
# Author: Michel Gagnon
# michel.gagnon@polytml.ca
from node import *
from state import *
def breadthfirst_search(initialState):
frontier = [Node(initialState)]
visited = set()
while frontier:
node = frontier.pop(0)
visited.add(node.state)
# node.st... | gaamy/INF4215_IA | tp1/breadthfirst_search.py | Python | gpl-2.0 | 634 | 0.003155 |
# Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# Author: Kiall Mac Innes <kiall@hpe.com>
#
# 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/... | grahamhayes/designate | designate/api/v2/controllers/tsigkeys.py | Python | apache-2.0 | 4,349 | 0 |
# -*- coding: utf-8 -*-
"""Unit/Functional tests"""
from __future__ import with_statement, unicode_literals
import datetime
import os
import sys
from django.contrib.admin.sites import AdminSite
from django.contrib.admin.views.main import ChangeList
from django.contrib.auth.models import User
from django.contrib.messa... | suziesparkle/wagtail | wagtail/vendor/django-treebeard/treebeard/tests/test_treebeard.py | Python | bsd-3-clause | 90,877 | 0.000044 |
from django.contrib.gis.db import models
class InputTypes(models.Model):
int_field = models.IntegerField(
null=True,
blank=True,
verbose_name="Integer field",
help_text="Enter an integer number.",
)
dec_field = models.FloatField(
null=True,
blank=True,
... | wq/xlsform-converter | tests/files/input_types/models.py | Python | mit | 2,324 | 0 |
import traceback
import requests
import time
import imghdr
from os.path import exists, isfile, join, isdir
from os import makedirs, listdir, walk
from flask import Blueprint, request, send_from_directory, render_template
filestore = Blueprint('callback', __name__)
@filestore.route('/clone', methods=["POST"])
def clo... | gradiuscypher/internet_illithid | mirror_shield/endpoints/filestore.py | Python | mit | 2,550 | 0.001176 |
import abc
import pprint
import six
def _decode_plain_type(value_type, buf):
if value_type == 'int8':
return buf.getInt8()
elif value_type == 'int16':
return buf.getInt16()
elif value_type == 'int32':
return buf.getInt32()
elif value_type == 'int64':
return buf.getInt64... | toddpalino/kafka-tools | kafka/tools/protocol/responses/__init__.py | Python | apache-2.0 | 2,328 | 0.000859 |
from django.core import serializers
from django.http import HttpResponse, JsonResponse
from Course.models import *
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_POST, require_GET
import json
@csrf_exempt
@require_POST
def addCourseCurriculum(request):
respon... | IEEEDTU/CMS | Course/views/CourseCurriculum.py | Python | mit | 2,775 | 0 |
print(__doc__)
# Author: Noel Dawe <noel.dawe@gmail.com>
#
# License: BSD 3 clause
from sklearn.externals.six.moves import zip
import matplotlib.pyplot as plt
from sklearn.datasets import make_gaussian_quantiles
from sklearn.ensemble import AdaBoostClassifier
from sklearn.metrics import accuracy_score
from sklearn.... | zhuango/python | sklearnLearning/statisticalAndSupervisedLearning/adaboost.py | Python | gpl-2.0 | 2,852 | 0.002454 |
# coding=utf-8
from __future__ import absolute_import
from .base import *
# ######### IN-MEMORY TEST DATABASE
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": ":memory:",
},
} | manazag/hopper.pw | hopperpw/hopperpw/settings/test.py | Python | bsd-3-clause | 229 | 0.004367 |
#!/usr/bin/python
"""Test of table output."""
from macaroon.playback import *
import utils
sequence = MacroSequence()
sequence.append(KeyComboAction("End"))
sequence.append(KeyComboAction("Up"))
sequence.append(KeyComboAction("<Shift>Right"))
sequence.append(KeyComboAction("Down"))
sequence.append(KeyComboAction("R... | chrys87/orca-beep | test/keystrokes/gtk-demo/role_table.py | Python | lgpl-2.1 | 3,344 | 0.001794 |
# 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... | failys/CAIRIS | cairis/test/test_Attacker.py | Python | apache-2.0 | 4,335 | 0.009919 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | kevin8909/xjerp | openerp/addons/crm/crm_lead.py | Python | agpl-3.0 | 53,864 | 0.005607 |
##############
# Standard #
##############
import io
import logging
import tempfile
##############
# External #
##############
import pytest
##############
# Module #
##############
import powermate
#Enable the logging level to be set from the command line
def pytest_addoption(parser):
parser.addoption('... | teddyrendahl/powermate | tests/conftest.py | Python | apache-2.0 | 1,119 | 0.008937 |
# Generated by Django 2.2.24 on 2021-10-26 15:29
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
dependencies = [
('sponsors', '0056_textasset'),
]
operations = [
migrations.AlterField(
model_name='genericasset',
name='... | manhhomienbienthuy/pythondotorg | sponsors/migrations/0057_auto_20211026_1529.py | Python | apache-2.0 | 416 | 0 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) David Arnold (devCO).
# Author David Arnold (devCO), dar@devco.co
# Co-Authors Juan Pablo Aries (devCO), jpa@devco.co
# Hector Ivan ... | odoousers2014/odoo | addons/l10n_co/__openerp__.py | Python | agpl-3.0 | 1,792 | 0 |
"""Thin wrapper around Werkzeug because Flask and Bottle
do not play nicely with async uwsgi"""
import json
from werkzeug.wrappers import Request, Response
from werkzeug.routing import Map, Rule
from werkzeug.exceptions import HTTPException, NotFound
from werkzeug.utils import redirect
from covador import ValidationD... | guilhermedallanol/dotfiles | vim/plugged/vial-http/server/dswf.py | Python | mit | 2,837 | 0.003525 |
# -*- encoding: utf-8 -*-
################################################################################
# #
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol #
# ... | CLVsol/odoo_addons | clv_patient/seq/clv_patient_category_seq.py | Python | agpl-3.0 | 3,797 | 0.007638 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
################################################################################
# gwindetk.py #
# #
# Part of UMass Amherst's Wind... | kmonsoor/windenergytk | windenergytk/gwindtk.py | Python | gpl-3.0 | 30,991 | 0.008648 |
# ===============================================================================
# Copyright 2013 Jake Ross
#
# 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/licens... | UManPychron/pychron | pychron/lasers/tasks/panes/ablation.py | Python | apache-2.0 | 4,882 | 0.004506 |
# pylint: disable=missing-docstring
from django.core.cache import cache
from django.test.utils import override_settings
from lang_pref import LANGUAGE_KEY
from xmodule.modulestore.tests.factories import (check_mongo_calls, CourseFactory)
from student.models import anonymous_id_for_user
from student.models import UserP... | ahmadiga/min_edx | lms/djangoapps/oauth2_handler/tests.py | Python | agpl-3.0 | 9,001 | 0.001333 |
#import list
import asyncio
import discord
from discord.ext import commands
import importlib.machinery
import datetime
import requests
import json
from bs4 import BeautifulSoup as BS
from requests import get as re_get
from random import *
from re import findall, match, search
TooBig = ["You know you make a cool bot an... | ImTheTom/discordBot | cogs/search.py | Python | mit | 12,276 | 0.008635 |
#!/usr/bin/python
# vi: ts=4 expandtab syntax=python
##############################################################################
# Copyright (c) 2008 IBM Corporation
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which acco... | Awingu/open-ovf | py/tests/OvfEnvironmentTestCase.py | Python | epl-1.0 | 22,345 | 0.002775 |
STATUS_ICONS = { "success": ""
, "warning": ""
, "failure": ""
, "feature": ""
}
REVIEW_MAP = { 'approved': 'success'
, 'unreviewed': 'warning'
, 'rejected': 'failure'
, 'featured': 'feat... | gratipay/gratipay.com | gratipay/utils/icons.py | Python | mit | 341 | 0.046921 |
from django.apps import AppConfig
class ImagerProfileAppConfig(AppConfig):
name = "imager_profile"
verbose_name = "Imager User Profile"
def ready(self):
"""code to run when the app is ready"""
from imager_profile import handlers
| crashtack/django-imager | imager_profile/apps.py | Python | mit | 260 | 0 |
def get_viewport_rect(session):
return session.execute_script("""
return {
height: window.innerHeight || document.documentElement.clientHeight,
width: window.innerWidth || document.documentElement.clientWidth,
};
""")
def get_inview_center(elem_rect, viewport_rect):
x =... | scheib/chromium | third_party/blink/web_tests/external/wpt/webdriver/tests/perform_actions/support/mouse.py | Python | bsd-3-clause | 927 | 0.004315 |
#!/usr/bin/env python
#########################################################################################
#
# Compute magnetization transfer ratio (MTR).
#
# ---------------------------------------------------------------------------------------
# Copyright (c) 2014 Polytechnique Montreal <www.neuro.polymtl.ca>
#... | neuropoly/spinalcordtoolbox | spinalcordtoolbox/scripts/sct_compute_mtr.py | Python | mit | 2,861 | 0.003146 |
import json
import urllib
import urllib2
import sys
for login in json.load(open(sys.argv[1])):
if login['EmailAddress']:
try:
# encode the json
data = urllib.urlencode(login)
# make the POST request
#
response = urllib2.urlopen('https://login.eovendo.com', data, 10)
# encode ... | Discountrobot/Headless | headless/checkLogins.py | Python | mit | 715 | 0.020979 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-02-04 16:09
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('meinberlin_organisations', '0006_update_orga_type_string'),
]
operations = [
migra... | liqd/a4-meinberlin | meinberlin/apps/organisations/migrations/0007_remove_organisation_type.py | Python | agpl-3.0 | 420 | 0 |
from abc import ABCMeta
from collections import OrderedDict
from collections.abc import Iterable
from copy import deepcopy
from math import sqrt, floor
from numbers import Real, Integral
from xml.etree import ElementTree as ET
import numpy as np
import openmc.checkvalue as cv
import openmc
from openmc._xml import get... | johnnyliu27/openmc | openmc/lattice.py | Python | mit | 53,509 | 0.000523 |
# -*- coding: utf-8 -*-
# hhfit.py ---
# Description:
# Author:
# Maintainer:
# Created: Tue May 21 16:31:56 2013 (+0530)
# Commentary:
# Functions for fitting common equations for Hodgkin-Huxley type gate
# equations.
import traceback
import warnings
import numpy as np
import logging
logger_ = logging.getLogger('moo... | dilawar/moose-core | python/moose/neuroml2/hhfit.py | Python | gpl-3.0 | 8,486 | 0.001414 |
import json
from geoalchemy2 import Geometry
from sqlalchemy import BigInteger, Boolean, Column, DateTime, Float, ForeignKey, ForeignKeyConstraint, String, Table, \
func as sqla_fn
from sqlalchemy.dialects.postgresql import DOUBLE_PRECISION, JSONB
from sqlalchemy.orm import relationship
from plenario.database imp... | UrbanCCD-UChicago/plenario | plenario/models/SensorNetwork.py | Python | mit | 8,829 | 0.00068 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2010 TÜBİTAK UEKAE
# Licensed under the GNU General Public License, version 3.
# See the file http://www.gnu.org/copyleft/gpl.txt. | MehmetNuri/ozgurlukicin | beyin2/__init__.py | Python | gpl-3.0 | 188 | 0.005376 |
r"""
Create MapServer class diagrams
Requires https://graphviz.gitlab.io/_pages/Download/Download_windows.html
https://stackoverflow.com/questions/1494492/graphviz-how-to-go-from-dot-to-a-graph
For DOT languge see http://www.graphviz.org/doc/info/attrs.html
cd C:\Program Files (x86)\Graphviz2.38\bin
dot -Tpng D:\Git... | geographika/mappyfile | docs/scripts/class_diagrams.py | Python | mit | 3,102 | 0.000645 |
from django.conf.urls import url
urlpatterns = [
url(
r'delete_report_download',
'openedx.stanford.lms.djangoapps.instructor.views.api.delete_report_download',
name='delete_report_download',
),
url(
r'^get_blank_lti$',
'openedx.stanford.lms.djangoapps.instructor.view... | caesar2164/edx-platform | openedx/stanford/lms/djangoapps/instructor/urls.py | Python | agpl-3.0 | 1,465 | 0.004096 |
from setuptools import setup
setup(
name='TogglViz',
version='0.1dev',
author='Marko Burjek',
packages=['togglviz', ],
scripts=['bin/fill.py', ],
license='LICENSE.txt',
long_description=open('README.txt').read(),
install_requires=[
"SQLAlchemy... | buma/TogglViz | setup.py | Python | gpl-2.0 | 438 | 0 |
import click
import requests
@click.command()
@click.argument('url')
@click.option('--show-headers', '-H', is_flag=True, default=False)
@click.option('--show-status', '-S', is_flag=True, default=False)
@click.option('--quiet', '-Q', is_flag=True, default=False)
@click.option('--allow-redirects/--no-allow-redirects', d... | tylerdave/reqcli | reqcli/cli.py | Python | mit | 1,667 | 0.004199 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | mfherbst/spack | lib/spack/spack/util/environment.py | Python | lgpl-2.1 | 3,500 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('filer', '0002_auto_20150606_2003'),
]
operations = [
migrations.CreateModel(
name='ExifData',
fields... | svenhertle/django_image_exif | image_exif/migrations/0001_initial.py | Python | mit | 1,140 | 0.005263 |
#rewrite of original calTimer to use qthreads as opposed to native python threads
#needed to make UI changes (impossible from native)
#also attempting to alleviate need for sigterm to stop perm loop
from PyQt4 import QtCore
import time,os,ctypes
import sys
class calTimer(QtCore.QThread):
xml_file = './data/data.... | CPSC491FileMaker/project | calTimer.QThread.py | Python | gpl-2.0 | 717 | 0.013947 |
# -*- coding: utf-8 -*-
__author__ = 'Sergey Efimov'
| serefimov/billboards | billboards/boards/parsing/__init__.py | Python | mit | 57 | 0.017544 |
from django.utils.translation import ugettext as _
#=========================================================================
# HELPERS
#=========================================================================
def get_display(key, list):
d = dict(list)
if key in d:
return d[key]
return None
def ... | marco-lancini/Showcase | app_collaborations/options.py | Python | mit | 5,831 | 0.008918 |
#
# 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 distributed in the hope that it will be useful,
... | TelekomCloud/virt-manager | tests/nodedev.py | Python | gpl-2.0 | 9,369 | 0.000534 |
# -*- coding: utf-8 -*-
import logging
from flask.ext import wtf
from google.appengine.api import mail
import flask
import config
import util
app = flask.Flask(__name__)
app.config.from_object(config)
app.jinja_env.line_statement_prefix = '#'
app.jinja_env.line_comment_prefix = '##'
app.jinja_env.globals.update(sl... | jaja14/lab5 | main/main.py | Python | mit | 5,013 | 0.007181 |
#
# This file is 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
# distr... | TresAmigosSD/SMV | src/test/python/testModuleHash/after/src/main/python/stage/modules.py | Python | apache-2.0 | 4,078 | 0.012016 |
# Copyright (C) 2010 Google Inc. All rights reserved.
# Copyright (C) 2010 Gabor Rapcsanyi (rgabor@inf.u-szeged.hu), University of Szeged
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of so... | indashnet/InDashNet.Open.UN2000 | android/external/chromium_org/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py | Python | apache-2.0 | 20,425 | 0.003329 |
# Copyright (c) 2012-2013 Mitch Garnaat http://garnaat.org/
# Copyright 2012-2014 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http... | LockScreen/Backend | venv/lib/python2.7/site-packages/botocore/credentials.py | Python | mit | 22,856 | 0.000306 |
'''So you want a quick and dirty command line app without screwing around
with argparse or getopt, but also without a complicated if-else on the length
of sys.argv. You don't really need a comprehensive help file, because it's just
you running the script and knowing what options are available is enough.
How many boiler... | buchuki/opterator | examples/basic.py | Python | mit | 1,198 | 0.000835 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import re
import sys
import argparse
import warnings
import collections
from flask import current_app
from werkzeug.utils import cached_property
from . import mimetype
from . import compat
from .compat import deprecated, usedoc
def defaultsnamedtuple(name, fields, defa... | ergoithz/browsepy | browsepy/manager.py | Python | mit | 24,389 | 0 |
import random, itertools, operator, types, pprint, contextlib, collections
import textwrap, string, pdb, copy, abc, functools
memoiziraj = functools.lru_cache(maxsize=None)
def djeljiv(m, n):
"""Je li m djeljiv s n?"""
return not m % n
def ispiši(automat):
"""Relativno uredan ispis (konačnog ili potisnog... | vedgar/ip | Chomsky/util.py | Python | unlicense | 14,523 | 0.002998 |
import socket
ip_port=("127.0.0.1",9999)
#买手机
s=socket.socket()
#直接打电话
s.connect(ip_port)
while True:
#发消息
send_data=input("please ").strip()
if len(send_data)==0:
continue
send_data=bytes(send_data,encoding="utf8")
#客户端发消息 s相当于服务端的conn
s.send(send_data)
print("------------------... | xiaoyongaa/ALL | 网络编程第四周/socket_client.py | Python | apache-2.0 | 717 | 0.038052 |
#!/usr/bin/env python2.7
from os.path import dirname, join, isfile, realpath, relpath, split, exists
from zipfile import ZipFile
import sys
sys.path.insert(0, 'buildlib/jinja2.egg')
sys.path.insert(0, 'buildlib')
from fnmatch import fnmatch
import tarfile
import os
import shutil
import subprocess
import time
import j... | kived/python-for-android | pythonforandroid/bootstraps/pygame/build/build.py | Python | mit | 18,072 | 0.000664 |
from gomatic.go_cd_configurator import HostRestClient, GoCdConfigurator
from gomatic.gocd.agents import Agent
from gomatic.gocd.materials import GitMaterial, PipelineMaterial
from gomatic.gocd.pipelines import Tab, Job, Pipeline, PipelineGroup
from gomatic.gocd.tasks import FetchArtifactTask, ExecTask, RakeTask
from go... | jimarnold/gomatic | gomatic/__init__.py | Python | mit | 484 | 0.002066 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import unittest
from... | digwanderlust/pants | tests/python/pants_test/backend/jvm/targets/test_jvm_binary.py | Python | apache-2.0 | 9,783 | 0.00828 |
#
# __init__.py
#
# Deluge is free software.
#
# You may 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.
#
# deluge is distributed in the hope that it will be u... | zoff/torrentz-deluge-plugin | torrentztrackersautoload/__init__.py | Python | gpl-2.0 | 1,603 | 0.000624 |
# 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... | xuleiboy1234/autoTitle | tensorflow/tensorflow/python/estimator/model_fn.py | Python | mit | 12,173 | 0.004354 |
'''
Created on Jan 15, 2014
@author: Jose Borreguero
'''
from setuptools import setup
setup(
name = 'dsfinterp',
packages = ['dsfinterp','dsfinterp/test' ],
version = '0.1',
description = 'Cubic Spline Interpolation of Dynamics Structure Factors',
long_description = open('README.md').read(),
author = 'J... | camm/dsfinterp | setup.py | Python | mit | 880 | 0.027273 |
import json
import uuid
from django.contrib.auth import logout
from django.shortcuts import render, redirect
from django.template.loader import render_to_string
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from watsan.models import WatsanUserMeta, Organization, N... | spatialcollective/watsan | watsan/views/settings_views.py | Python | mit | 4,402 | 0.024989 |
from .base import BASE_DIR, INSTALLED_APPS, MIDDLEWARE_CLASSES, REST_FRAMEWORK
DEBUG = True
ALLOWED_HOSTS = ['127.0.0.1']
SECRET_KEY = 'secret'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'holonet',
'USER': 'holonet',
'PASSWORD': '',
... | webkom/holonet | holonet/settings/development.py | Python | mit | 1,029 | 0.000972 |
# Headlights testing
# Designed to be run by Travis CI. Should work for humans too, we suppose. But humans? Bleh.
# Remember to set the HEADLIGHTS_TESTMODE and HEADLIGHTS_DPKEY env-vars before testing.
import tests.configuration, tests.printer, tests.server, tests.plugins
import main
try:
# Run the configuration ... | mashedkeyboard/Headlights | runtests.py | Python | gpl-3.0 | 1,771 | 0.003953 |
# -*- encoding: utf-8 -*-
from . import res_partner_bank
from . import account_bank_statement_import
| StefanRijnhart/bank-statement-import | account_bank_statement_import/__init__.py | Python | agpl-3.0 | 102 | 0 |
def consumer():
r = ''
while True:
n = yield r
if not n:
return
print('[CONSUMER] Consuming %s...' % n)
r = '200 OK'
def produce(c):
c.send(None)
n = 0
while n < 5:
n = n + 1
print('[PRODUCER] Producing %s...' % n)
r = c.send(n)
... | ianzhengnan/learnpy | coroutine.py | Python | apache-2.0 | 413 | 0.004843 |
from datetime import datetime
import listenbrainz_spark.stats.utils as stats_utils
from listenbrainz_spark.path import LISTENBRAINZ_DATA_DIRECTORY
from listenbrainz_spark import utils
from listenbrainz_spark.tests import SparkTestCase
from listenbrainz_spark.stats import offset_months, offset_days
from pyspark.sql im... | Freso/listenbrainz-server | listenbrainz_spark/stats/tests/test_utils.py | Python | gpl-2.0 | 2,000 | 0.0035 |
from __future__ import print_function
import IMP
import IMP.test
import IMP.domino
import IMP.core
class TrivialParticleStates(IMP.domino.ParticleStates):
def __init__(self, n):
IMP.domino.ParticleStates.__init__(self)
self.key = IMP.IntKey("hi")
self.n = n
def get_number_of_particle... | shanot/imp | modules/domino/test/test_bandb_sampler.py | Python | gpl-3.0 | 1,701 | 0.000588 |
import curses
from cursesmenu import clear_terminal
from cursesmenu.items import MenuItem
class ExternalItem(MenuItem):
"""
A base class for items that need to do stuff on the console outside of curses mode.
Sets the terminal back to standard mode until the action is done.
Should probably be subclass... | mholgatem/GPIOnext | cursesmenu/items/external_item.py | Python | mit | 1,040 | 0.002885 |
# -*- 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 model 'Country'
db.create_table(u'cities_country', (
... | blag/django-cities | cities/south_migrations/0001_initial.py | Python | mit | 19,791 | 0.007124 |
# encoding: UTF-8
import os
class Constant:
conf_dir = os.path.join(os.path.expanduser('~'), '.netease-musicbox')
download_dir = conf_dir + "/cached"
| smileboywtu/LTCodeSerialDecoder | netease/const.py | Python | apache-2.0 | 163 | 0.01227 |
# -*- coding: utf-8 -*-
# (c) 2016 Alfredo de la Fuente - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openerp import models, fields, api
class OperationTimeLine(models.Model):
_inherit = 'operation.time.line'
@api.depends('accepted_amount', 'rejected_amount')
@api.multi... | odoomrp/odoomrp-wip | mrp_operations_rejected_quantity/models/operation_time_line.py | Python | agpl-3.0 | 1,038 | 0 |
from unittest import TestCase
import pickle
from abl.util import (
Bunch,
)
class Derived(Bunch):
pass
class TestBunch(TestCase):
def test_as_dict(self):
bunch = Bunch(a='a', b='b')
assert bunch == dict(a='a', b='b')
def test_as_obj(self):
bunch = Bunch(a='a', b='b')
... | AbletonAG/abl.util | test/test_bunch.py | Python | mit | 1,113 | 0.002695 |
# pylint: disable=C0111,R0902,R0904,R0912,R0913,R0915,E1101
# Smartsheet Python SDK.
#
# Copyright 2018 Smartsheet.com, 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.... | smartsheet-platform/smartsheet-python-sdk | smartsheet/models/access_token.py | Python | apache-2.0 | 2,612 | 0 |
"""
Django settings for bbp_oa project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
imp... | ekivemark/my_device | bbp/bbp/settings.py | Python | apache-2.0 | 11,481 | 0.002178 |
#!/usr/bin/env python3
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2018-2021 Andy Mender <andymenderunix@gmail.com>
# Copyright 2019-2021 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
# This file is part of qutebrowser.
#
# qutebrowser is free software: you can redistribute it and/or modify
... | forkbong/qutebrowser | scripts/dev/update_version.py | Python | gpl-3.0 | 3,202 | 0.000312 |
from django import forms
from django.forms.models import ModelForm
from .models import Alert, AlertType, AlertUpdate, AlertEmailTemplate
from django.template import Template, TemplateSyntaxError
class AlertTypeForm(ModelForm):
class Meta:
model = AlertType
exclude = ('hidden', 'config')
class Ema... | sfu-fas/coursys | oldcode/alerts/forms.py | Python | gpl-3.0 | 1,401 | 0.012848 |
# -*- coding: utf-8 -*-
import os
from setuptools import setup
# Utility function to read the README file.
# Used for the long_description. It's nice, because now 1) we have a top level
# README file and 2) it's easier to type in the README file than to put a raw
# string in below ...
def read(fname):
return open... | rosscdh/django-crocodoc | setup.py | Python | gpl-2.0 | 911 | 0.021954 |
# -*- coding: utf-8 -*-
{
'name': "Gestión de los Consejos Comunales",
'summary': """
Short (1 phrase/line) summary of the module's purpose, used as
subtitle on modules listing or apps.openerp.com""",
'description': """
Long description of module's purpose
""",
'author': "... | yorgenisparacare/tuconsejocomunal | tcc_consejocomunales/__openerp__.py | Python | gpl-3.0 | 943 | 0.002123 |
#from moderation import moderation
#from .models import SuccessCase
#moderation.register(SuccessCase)
| djangobrasil/djangobrasil.org | src/djangobrasil/success_cases/moderator.py | Python | gpl-3.0 | 104 | 0.028846 |
from django.core.management.base import NoArgsCommand
from django.conf import settings
class Command(NoArgsCommand):
help = "Removes CompSlides from the database that do not have matching files on the drive."
def handle_noargs(self, **options):
from stager.staging.models import CompSlide
im... | broderboy/ai-stager | stager/staging/management/commands/cleanupslides.py | Python | mit | 596 | 0.011745 |
# 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 | python/tvm/relay/op/_transform.py | Python | apache-2.0 | 26,343 | 0.000835 |
# #START_LICENSE###########################################################
#
#
# This file is part of the Environment for Tree Exploration program
# (ETE). http://etetoolkit.org
#
# ETE is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# t... | sauloal/cnidaria | scripts/venv/lib/python2.7/site-packages/ete2/tools/phylobuild_lib/task/cog_selector.py | Python | mit | 10,562 | 0.008426 |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2017 Alex Forencich
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 righ... | alexforencich/python-ivi | ivi/rigol/rigolDS4014.py | Python | mit | 1,674 | 0.002987 |
from dict_validator import Field
class Choice(Field):
"""
Accept any type of input as long as it matches on of the choices
mentioned in the provided list.
:param choices: list of choices to match against
>>> from dict_validator import validate, describe
>>> class Schema:
... field =... | gurunars/dict-validator | dict_validator/fields/choice_field.py | Python | mit | 1,274 | 0 |
# -*- coding: utf-8 -*-
import sys
cflags = [
'-std=c99',
'-Wall',
'-g',
'-O2',
# '-fno-strict-aliasing',
'-D_GNU_SOURCE',
'-Wimplicit-function-declaration',
'-Wunused-variable',
]
libs = [
'pthread',
'ev',
'json',
]
if sys.platform != 'darwin':
libs.append('rt')
incl... | cubicdaiya/neoagent | build/config.py | Python | bsd-3-clause | 660 | 0.00303 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import copy
import numpy as np
from astropy.table import Row
from astropy.cosmology.connect import convert_registry
from astropy.cosmology.core import Cosmology
from .mapping import from_mapping
def from_row(row, *, move_to_meta=False, cosmology=None... | mhvk/astropy | astropy/cosmology/io/row.py | Python | bsd-3-clause | 5,402 | 0.002777 |
# -*- coding: utf-8 -*-
import os
from django.conf import settings
from django.core.exceptions import PermissionDenied
from django.core.files.storage import FileSystemStorage
from django.forms import Form
from django.template.response import SimpleTemplateResponse
from django.urls import NoReverseMatch
from formtool... | benzkji/django-cms | cms/wizards/views.py | Python | bsd-3-clause | 5,882 | 0 |
import numpy as np
from pymeteo import constants
from .. import OptionsWidget
class straight(OptionsWidget.OptionsWidget):
def __init__(self):
super(straight,self).__init__()
name = 'straight (linear increase)'
variables = [ ('z_constabv', '6000', 'm'),
('z_constblo', '0', 'm'... | cwebster2/pyMeteo | pymeteo/cm1/hodographs/straight.py | Python | bsd-3-clause | 1,428 | 0.014706 |
from collections.abc import Sequence
from contextlib import contextmanager
from datetime import datetime
from difflib import Differ
import inspect
from itertools import product
import json
import multiprocessing
import operator
import os
from pathlib import Path
import pydoc
import re
import shlex
import shutil
import ... | TheBB/badger | grevling/__init__.py | Python | agpl-3.0 | 38,535 | 0.001972 |
""" A module to contain utility ISO-19115 metadata parsing helpers """
from _collections import OrderedDict
from copy import deepcopy
from frozendict import frozendict as FrozenOrderedDict
from parserutils.collections import filter_empty, reduce_value, wrap_value
from parserutils.elements import get_element_name, get... | consbio/gis-metadata-parser | gis_metadata/iso_metadata_parser.py | Python | bsd-3-clause | 32,703 | 0.003792 |
"""
===================
Resource Management
===================
This module provides a tool to manage dependencies on resources within a
:mod:`vivarium` simulation. These resources take the form of things that can
be created and utilized by components, for example columns in the
:mod:`state table <vivarium.framework.p... | ihmeuw/vivarium | src/vivarium/framework/resource.py | Python | bsd-3-clause | 12,125 | 0.000495 |
# coding=utf-8
# Copyright 2022 The TensorFlow GAN 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 applicabl... | tensorflow/gan | tensorflow_gan/examples/progressive_gan/layers.py | Python | apache-2.0 | 9,208 | 0.005213 |
"""Handles downloading and importing OSM Data"""
import os
import subprocess
import tempfile
import requests
from celery.utils.log import get_task_logger
from django.conf import settings
from django.db import connection
from datasources.models import OSMData, OSMDataProblem
from datasources.tasks.shapefile import E... | WorldBank-Transport/open-transit-indicators | python/django/datasources/tasks/osm.py | Python | gpl-3.0 | 4,966 | 0.001611 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.