text stringlengths 4 1.02M | meta dict |
|---|---|
import sys
import ctypes
import collections
from functools import total_ordering
from ._compat import PY2, string_types
from ._fsnative import is_win, _fsn2legacy, path2fsn
from . import _winapi as winapi
def _get_win_argv():
"""Returns a unicode argv under Windows and standard sys.argv otherwise
Returns:
... | {
"content_hash": "b8b61a5247d09b6b5b202fdfce9c4ff8",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 79,
"avg_line_length": 23.4,
"alnum_prop": 0.5704003598740441,
"repo_name": "lazka/senf",
"id": "c335b598faeecb2b155a501b63dea90d7a27947b",
"size": "3341",
"binary": fals... |
from django.test import TestCase
from timepiece.tests import factories
from timepiece.tests.base import ViewTestMixin
class TestQuickSearchView(ViewTestMixin, TestCase):
url_name = 'quick_search'
template_name = 'timepiece/quick_search.html'
def setUp(self):
super(TestQuickSearchView, self).setU... | {
"content_hash": "7f429de18b7717ed7985d7ff6b15b789",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 75,
"avg_line_length": 36.21686746987952,
"alnum_prop": 0.6284098469727212,
"repo_name": "josesanch/django-timepiece",
"id": "6840ed14505a6ee181de0e3c634a036653c39544",
"si... |
"""
raven.utils.serializer.base
~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import itertools
import types
from raven.utils.compat import text_type, binary_type, string_t... | {
"content_hash": "48a1c58bba1b8bc4bad18924e1e9c180",
"timestamp": "",
"source": "github",
"line_count": 188,
"max_line_length": 81,
"avg_line_length": 29.164893617021278,
"alnum_prop": 0.618639430968448,
"repo_name": "mottosso/mindbender-setup",
"id": "06753b228f15a67d5507ce9f4f1693730030df00",
"si... |
hasJoblib = False
try:
from joblib import Parallel, delayed
hasJoblib = True
except ImportError:
pass
import itertools
import subprocess
import os, re, gzip
options = {}
options["compact"] = True # only show pages with diff
options["compact-surround"] = 0 # how many pages to add bef... | {
"content_hash": "ec110edb56f39cfeffe8bf9390530330",
"timestamp": "",
"source": "github",
"line_count": 259,
"max_line_length": 191,
"avg_line_length": 35.33976833976834,
"alnum_prop": 0.5622200371462909,
"repo_name": "hgustafsson/skillnad",
"id": "ea2a99a591d9f2ec25d8831858b841b3e8e6a835",
"size":... |
from __future__ import absolute_import
import os
import sys
import signal
import psutil
from oslo_config import cfg
import st2tests.config
from st2common.util import concurrency
from st2common.models.db import db_setup
from st2reactor.container.process_container import PROCESS_EXIT_TIMEOUT
from st2common.util.green.... | {
"content_hash": "c6c48b885a9d2a5144984c27f761951f",
"timestamp": "",
"source": "github",
"line_count": 239,
"max_line_length": 98,
"avg_line_length": 31.384937238493723,
"alnum_prop": 0.6293827489668045,
"repo_name": "StackStorm/st2",
"id": "687c9f91025f774794da8ddd5e1ef6e62d6d864d",
"size": "8129... |
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import os
# Third-party
import astropy.units as u
from astropy.utils import isiterable
from astropy.coordinates import SkyCoord, frame_transform_graph
from flask import Flask, request, render_template, se... | {
"content_hash": "fd8a5cf17471a7d2ea0bd19a1cfcfb85",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 91,
"avg_line_length": 24.59375,
"alnum_prop": 0.7026683608640406,
"repo_name": "eteq/Astropy-WebAPI",
"id": "43d6bb60170ee85ba948d7ab1196ee74abe88c81",
"size": "804",
"b... |
import base64
import urllib
import time
import random
import urlparse
import hmac
import binascii
try:
from urlparse import parse_qs, parse_qsl
except ImportError:
from cgi import parse_qs, parse_qsl
from restkit.util import to_bytestring
try:
from hashlib import sha1
sha = sha1
except ImportError:
... | {
"content_hash": "30e51d820002aabbb335141c1afa34cb",
"timestamp": "",
"source": "github",
"line_count": 670,
"max_line_length": 265,
"avg_line_length": 32.876119402985076,
"alnum_prop": 0.5959958233077587,
"repo_name": "benoitc/restkit",
"id": "1591574ca3146e2e58acfe0ffc168ef29f6808de",
"size": "22... |
"""Fuzzing module.
The main entry point to GraphicsFuzz Auto.
"""
import argparse
import enum
import os
import random
import secrets
import shutil
import sys
from pathlib import Path
from typing import List, Optional
from gfauto import (
artifact_util,
binaries_util,
devices_util,
download_cts_gf_tes... | {
"content_hash": "5bef1e1bb69bcf990cb5fcdeec433f9a",
"timestamp": "",
"source": "github",
"line_count": 482,
"max_line_length": 158,
"avg_line_length": 37.13900414937759,
"alnum_prop": 0.6390704429920117,
"repo_name": "google/graphicsfuzz",
"id": "f6d837950280029a8b72f343f8f2c6fad34486d8",
"size": ... |
from django.db import models
from django.core.validators import MaxLengthValidator
from django.utils import timezone
from datetime import datetime, timedelta
from webtools import settings
from django.utils.translation import ugettext_lazy as _
import hashlib
import uuid
EXPIRE_CHOICES = (
(0, _('Never expire')),
... | {
"content_hash": "e933b99f470d242284866495498e98d5",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 88,
"avg_line_length": 31.88695652173913,
"alnum_prop": 0.6304881374420507,
"repo_name": "setsuna-/pasteque",
"id": "b1a1aa90996dc98d407c1f12fcab397c670e752f",
"size": "36... |
from httplang import *
import sys
import os
if len(sys.argv) < 2:
sys.exit("Usage: python httplang.py <file>.httpl")
if not os.path.exists(sys.argv[1]):
sys.exit("No file names {}".format(sys.argv[1]))
evaluate.evaluate(parse.program(tokenize.getTokens(open(sys.argv[1]))))
| {
"content_hash": "3b90fe79ea3c36ffab25b595858b8703",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 71,
"avg_line_length": 25.90909090909091,
"alnum_prop": 0.6982456140350877,
"repo_name": "Max00355/HTTPLang",
"id": "04d087bde266a42f9b1131b72c5554c459b8049b",
"size": "285... |
import tests.missing_data.test_missing_data_air_passengers_generic as gen
gen.test_air_passengers_missing_data(None, 'DiscardRow')
| {
"content_hash": "3e73cbcda2e794eb1a58acef3a69ce61",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 73,
"avg_line_length": 44,
"alnum_prop": 0.8106060606060606,
"repo_name": "antoinecarme/pyaf",
"id": "87005d286f810387288915680747a9ef8af840f0",
"size": "132",
"binary": f... |
from msrest.serialization import Model
class PacketCaptureParameters(Model):
"""Parameters that define the create packet capture operation.
:param target: The ID of the targeted resource, only VM is currently
supported.
:type target: str
:param bytes_to_capture_per_packet: Number of bytes captur... | {
"content_hash": "ed36494700922eeec7dd412b3e191c4d",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 159,
"avg_line_length": 44.020833333333336,
"alnum_prop": 0.6691907240889731,
"repo_name": "AutorestCI/azure-sdk-for-python",
"id": "e643fc93902fbfffc30b961eb789b1aa6aa61eac"... |
from __future__ import absolute_import
from django.core.exceptions import ImproperlyConfigured
from bootstrapper.settings.base import *
def get_env_variable(var_name):
try:
return os.environ[var_name]
except KeyError: # pragma: no cover
error_msg = "Set the %s environment variable" % var_nam... | {
"content_hash": "a4c747e252de3c74bf74363c9d32ffed",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 82,
"avg_line_length": 29.524590163934427,
"alnum_prop": 0.6785119378123264,
"repo_name": "rjusher/docker-container-manager",
"id": "2fa0d2d19b6dfd1f789cbb2f2b4769ad3ea9f4c4"... |
from __future__ import unicode_literals
import datetime
import tempfile
import os
from django.contrib.auth.models import User
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
from django.core.files.storage import FileSystemStorage
from django.db import models
... | {
"content_hash": "bfe3f90df73df944f16b805526bb12f5",
"timestamp": "",
"source": "github",
"line_count": 679,
"max_line_length": 110,
"avg_line_length": 25.98821796759941,
"alnum_prop": 0.6781706902414145,
"repo_name": "hellhovnd/django",
"id": "1916949f63fc414740f63c6405b2bbee231d8ac8",
"size": "17... |
from django.test import TestCase
from django.contrib.auth.models import User
from robocrm.models import RoboUser
class RoboUserLabelTests(TestCase):
def test_get_label_superuser_admin(self):
"""
Should be able to get label through admin interface.
"""
password = 'test'
user = User.objects... | {
"content_hash": "b9839050605fbf9d441f9dae3c88b7f9",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 107,
"avg_line_length": 36.421052631578945,
"alnum_prop": 0.7369942196531792,
"repo_name": "sreidy/roboticsclub.org",
"id": "e9f30f45b503a011e0653cc1cae30b8ccaf1bb08",
"siz... |
import collections
# Copyright 2011 OpenStack LLC.
# Copyright (c)2012 Rackspace US, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://... | {
"content_hash": "7c3b0778407473b9ec466841664ed0af",
"timestamp": "",
"source": "github",
"line_count": 313,
"max_line_length": 80,
"avg_line_length": 34.57827476038339,
"alnum_prop": 0.598724937632819,
"repo_name": "rackerlabs/heat-pyrax",
"id": "3610b8c09c092198673c573400f34417de51eb86",
"size": ... |
import math
from pandac.PandaModules import *
from direct.showbase import DirectObject
import direct.directbase.DirectStart
class InitODE(DirectObject.DirectObject):
"""This creates the various ODE core objects,
and exposes them to other plugins. Should be called ode."""
def __init__(self,manager,xml):
... | {
"content_hash": "38a577655fc910f2c1cf40ebbfd915bf",
"timestamp": "",
"source": "github",
"line_count": 230,
"max_line_length": 120,
"avg_line_length": 36.869565217391305,
"alnum_prop": 0.6641509433962264,
"repo_name": "frainfreeze/FPS-kit",
"id": "0be0dc0e2e09e97c78e9c2053c41e839f4e96ae7",
"size":... |
from django.contrib.auth.decorators import login_required, user_passes_test
from ..models import Pessoa, Procedimento, Solicita, Realiza
from django.http import *
from django.shortcuts import render_to_response
from django.template import RequestContext
from time import strftime
from pymongo import MongoClient
import h... | {
"content_hash": "aef7b1098d5051ff3755776e14314ecc",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 134,
"avg_line_length": 42.86029411764706,
"alnum_prop": 0.5532681420483788,
"repo_name": "andredalton/imecare",
"id": "10bebf3d29c25da5ac02e537173488d838c0d639",
"size": ... |
"""Default Formatter for Google."""
from .base import Base
class GoogleFormatter(Base):
"""Documentation Formatter Class."""
name = 'google'
def decorators(self, attributes):
"""Create snippet string for a list of decorators."""
return ''
def extends(self, attributes):
"""Cr... | {
"content_hash": "55397ad08fa693986057092b88ffc8eb",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 91,
"avg_line_length": 31.643564356435643,
"alnum_prop": 0.5682102628285357,
"repo_name": "adambullmer/sublime-docblockr-python",
"id": "64d24e2458ed4b23c3dbc5a10121892b5dd2... |
from six.moves import urllib_parse as urlparse
import jsonpointer
from flex.exceptions import (
ValidationError,
)
from flex.datastructures import (
ValidationDict,
)
from flex.error_messages import MESSAGES
from flex.constants import (
OBJECT,
STRING,
)
from flex.decorators import (
skip_if_not_o... | {
"content_hash": "c1d2c275aceccc450e8a8ff06edab437",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 80,
"avg_line_length": 24.10169491525424,
"alnum_prop": 0.6765119549929677,
"repo_name": "pipermerriam/flex",
"id": "50ce601b62d7c7d8a8e336a8577885d63585dc67",
"size": "142... |
"""
Contains various network topologies and scenarios.
See help of individual scenarios for more info.
"""
| {
"content_hash": "5440aa20a0140a1fc66e0daa2500e884",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 50,
"avg_line_length": 26.75,
"alnum_prop": 0.7757009345794392,
"repo_name": "zhaoyan1117/RoutingProtocols",
"id": "a352f953f0d7381efe6f85054a360bad22c65eb3",
"size": "107",... |
__author__ = 'Jonathan Brodie'
from hzclient.codec import alongcodec
from hzclient.codec import proxycodec
class ALongProxy(object):
def __init__(self,title,conn):
self.title=title
self.connection=conn
firstpack=proxycodec.createProxy(self.title,"hz:impl:atomicLongService")
self.... | {
"content_hash": "ccdb4afb70a8f2d88b4135338ccdfaf6",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 88,
"avg_line_length": 38.87179487179487,
"alnum_prop": 0.7180079155672823,
"repo_name": "hazelcast-incubator/pyhzclient",
"id": "ed7bd32d8153bf1045a45c1d89b957951adbb529",
... |
'''
INSTRUCTION:
Please configure parameters in __main__,
especially the configurable variable "trainFlag", which is the SWITCH between TRAINING_MODE and PREDICTION_MODE.
TRAINING_MODE will generate two files for User_Feature_Model and Movie_Feature_Model respectively, which could be used f... | {
"content_hash": "76251e414ef264966115680f84d70a44",
"timestamp": "",
"source": "github",
"line_count": 182,
"max_line_length": 172,
"avg_line_length": 41.68681318681319,
"alnum_prop": 0.5795439567681561,
"repo_name": "gypleon/codesCloud",
"id": "b5b747da798c87c82183c23d864d34c2c33a7a89",
"size": "... |
debug = False
| {
"content_hash": "55325e07fdb61634673f299675b9ecfc",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 13,
"avg_line_length": 14,
"alnum_prop": 0.7142857142857143,
"repo_name": "Akuryou/tornado-project-template",
"id": "a2601efb61a73043f2dfa595b607e6ab49141f5e",
"size": "14",... |
from abc import ABC, abstractproperty
import torch
from .. import settings
from ..distributions import Delta, MultivariateNormal
from ..module import Module
from ..utils.broadcasting import _mul_broadcast_shape
from ..utils.memoize import cached, clear_cache_hook
class _VariationalStrategy(Module, ABC):
"""
... | {
"content_hash": "cdd6347fd5f7e31031980366bc9f56ab",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 120,
"avg_line_length": 43.8705035971223,
"alnum_prop": 0.6510331256149557,
"repo_name": "jrg365/gpytorch",
"id": "bbba3229e1ed2b83cbdad549dbbed266f2c79ad3",
"size": "6122... |
import atexit
import logging
import subprocess
from pyroute2.remote import Transport
from pyroute2.remote import RemoteSocket
from pyroute2.iproute import RTNL_API
from pyroute2.netlink.rtnl.iprsocket import MarshalRtnl
log = logging.getLogger(__name__)
class ShellIPR(RTNL_API, RemoteSocket):
def __init__(self,... | {
"content_hash": "57ac17563941d0090782cc2b077634d6",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 75,
"avg_line_length": 29.746268656716417,
"alnum_prop": 0.5524335173105871,
"repo_name": "craneworks/python-pyroute2",
"id": "24e0502d41451d9fb4d8c49dda5fd788c6362da6",
"s... |
from thumbnails.conf import settings
from thumbnails.engines import DummyEngine
from thumbnails.helpers import get_engine, generate_filename, get_cache_backend
from thumbnails.images import SourceFile, Thumbnail
__version__ = '0.5.1'
def get_thumbnail(original, size, **options):
"""
Creates or gets an alread... | {
"content_hash": "7232c9590b9e5081b63874d1a67252ae",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 100,
"avg_line_length": 45.61904761904762,
"alnum_prop": 0.675365344467641,
"repo_name": "python-thumbnails/python-thumbnails",
"id": "412425d9e6174c8adcdee1a34ac95bdce60f035... |
from django.contrib.sites.models import Site
from django.db.models import Prefetch
from django.db.models.signals import post_delete, post_save
from django.utils.html import escape
from django.utils.safestring import mark_safe
from cms.cache.choices import _page_cache_key, _site_cache_key, clean_page_choices_cache, cle... | {
"content_hash": "e6e7c7305820cabca1e3653c28efb6c3",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 114,
"avg_line_length": 33.29,
"alnum_prop": 0.6566536497446681,
"repo_name": "rsalmaso/django-cms",
"id": "e1fdd329a2155e7691c00fe2dd958a1f07cd6e7f",
"size": "3329",
"b... |
"""
Clustertools offers the possibility to save partial results. This is handy with
long computations that can get interrupted (by a job scheduler like Slurm for
instance).
You just need to use the :meth:`save_result` method from the `Computation`
class.
So far, there is no way to restart a interrupted computation fr... | {
"content_hash": "94e4f5fd9c08a4531b1f6a8880b1b153",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 79,
"avg_line_length": 29.743243243243242,
"alnum_prop": 0.6201726487960019,
"repo_name": "jm-begon/clustertools",
"id": "21fefebf196f09bd684be6b6b93a63c904844a7c",
"size":... |
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('token_blacklist', '0005_remove_outstandingtoken_jti'),
]
operations = [
migrations.RenameField(
model_name='outstandingtoken',
old_n... | {
"content_hash": "83e735de9a4bbdfa687143ac982300e5",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 64,
"avg_line_length": 21.11111111111111,
"alnum_prop": 0.5947368421052631,
"repo_name": "kawamon/hue",
"id": "7a4067bb5ce7f6c314eb06ba9d893033c8d06401",
"size": "453",
"... |
"""Environments used for testing and benchmarking.
These are not a core part of the imitation package. They are relatively lightly tested,
and may be changed without warning.
"""
# Register environments with Gym
from imitation.envs.examples import airl_envs, model_envs # noqa: F401
| {
"content_hash": "b5b6f62f6e24cfac7a97a9a3bc03ffa8",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 87,
"avg_line_length": 35.75,
"alnum_prop": 0.7832167832167832,
"repo_name": "humancompatibleai/imitation",
"id": "e836e5c463b43076c4fe12d3cc7a190ddac40dcf",
"size": "286",
... |
import sys, itertools, functools
__izip_longest__ = itertools.izip_longest if sys.version_info.major < 3 else itertools.zip_longest
intofdata = lambda data: functools.reduce(lambda t, c: t * 256 | c, bytearray(data), 0)
dataofint = lambda integer: ((integer == 0) and b'\0') or (dataofint(integer // 256).lstrip(b'\0')... | {
"content_hash": "92509201d44a17d0af088eb3bae4e6db",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 139,
"avg_line_length": 48.375,
"alnum_prop": 0.6976744186046512,
"repo_name": "arizvisa/syringe",
"id": "3ed8a44ff9095e6f25cd5065dcdf41f4002edf01",
"size": "387",
"binary... |
"""Custom mail app exceptions"""
class MultiEmailValidationError(Exception):
"""
General exception for failures while validating multiple emails
"""
def __init__(self, invalid_emails, msg=None):
"""
Args:
invalid_emails (set of str): All email addresses that failed validat... | {
"content_hash": "bf3cae228703456a34dab6623a69810a",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 83,
"avg_line_length": 28.8125,
"alnum_prop": 0.6117136659436009,
"repo_name": "mitodl/bootcamp-ecommerce",
"id": "51b931d53004a5b305941659f5ab316c3fcd7489",
"size": "461",... |
import sys
import time
from core import pycore
from core.constants import *
from core.api import coreapi
def is_number(s):
try:
float(s)
return True
except ValueError:
return False
msg_types = {
'node': (1, coreapi.CORE_API_NODE_MSG, 'NODE'),
'link': (2, coreapi.CORE_A... | {
"content_hash": "69f1d41a6d380ca5198e5fa65d8275fc",
"timestamp": "",
"source": "github",
"line_count": 315,
"max_line_length": 104,
"avg_line_length": 35.08571428571429,
"alnum_prop": 0.5509410061527326,
"repo_name": "Benocs/core",
"id": "f9f1ec541db0a67e8440ec805be80281abd14d0a",
"size": "11257",... |
import os
import ssl
import gzip
import cPickle
from six.moves import urllib
def load_pickle(data_path):
data_dir, data_file = os.path.split(data_path)
if data_dir == "" and not os.path.isfile(data_path):
new_path = os.path.join(os.path.split(__file__)[0], data_path)
if os.path.isfile(new_path) or data_file == ... | {
"content_hash": "221bb268bc3f7b9566d18e4a1cfa877f",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 77,
"avg_line_length": 28.677419354838708,
"alnum_prop": 0.6895388076490439,
"repo_name": "mingkaic/rocnnet",
"id": "75f31873118c00c5cf6161598033bd39450b4f96",
"size": "911... |
from electrum_cesc.util import print_error
from urlparse import urlparse, parse_qs
from PyQt4.QtGui import QPushButton, QMessageBox, QDialog, QVBoxLayout, QHBoxLayout, QGridLayout, QLabel, QLineEdit, QComboBox
from PyQt4.QtCore import Qt
from electrum_cesc.i18n import _
import re
import os
from electrum_cesc import Tr... | {
"content_hash": "d21ca88d9fa1472dbe7b3356591f9308",
"timestamp": "",
"source": "github",
"line_count": 386,
"max_line_length": 165,
"avg_line_length": 34.6580310880829,
"alnum_prop": 0.5746000896995066,
"repo_name": "Marcdnd/electrum-cesc",
"id": "a92f2fc5337e19b40490a924e07607d565f5f4a8",
"size":... |
from pin.lib import p, util, ui
import unittest
from mock import Mock, patch
from tests import fixtures
class TestImage(unittest.TestCase):
def setUp(self):
fixtures.reset()
image = Mock()
image.get_width = Mock()
image.get_width.return_value = 20
image.get_height = Mock()... | {
"content_hash": "287dcddaa9b2c173b7612ee9b9bdbcec",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 43,
"avg_line_length": 25.757575757575758,
"alnum_prop": 0.6188235294117647,
"repo_name": "town-hall-pinball/project-omega",
"id": "cb9e60c7758f129b97909c1519f31e5ebac288da",... |
import os
import shutil
import sys
# Ensures that the current version matches the last-produced version, which is
# stored in the version_file. If it does not, then the framework_root_dir is
# obliterated.
# Usage: python prepare_framework_version.py out/obj/version_file \
# ... | {
"content_hash": "15a88ad0d975f4f4d196983459b4dd6d",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 78,
"avg_line_length": 31.973684210526315,
"alnum_prop": 0.6567901234567901,
"repo_name": "google-ar/WebARonARCore",
"id": "5e8a53f20ab7e6fda29012aa871455f75ae99e1a",
"size... |
'''
Created on 25.01.2015
@author: patrick
'''
import json
import logging
import raumfeld
import threading
from bottle import route, run
from urllib import quote, unquote
updateAvailableEvent = threading.Event()
def __getSingleZone(name_udn):
"""Tries to find the first occurring Zone with the specified name or ... | {
"content_hash": "c4ed6a6ec5b3ed95386eb78b7a40b21b",
"timestamp": "",
"source": "github",
"line_count": 377,
"max_line_length": 237,
"avg_line_length": 33.51193633952255,
"alnum_prop": 0.6230805762228906,
"repo_name": "maierp/PyRaumfeld",
"id": "7f13552d5cf4ab981382caee15c677347c1cac03",
"size": "1... |
import numpy as np
from matplotlib.backends.backend_pdf import FigureCanvasPdf as FigureCanvas
from matplotlib.backends.backend_pdf import PdfPages
from matplotlib.figure import Figure
#import matplotlib.mlab as mlab
import mpl_toolkits.axisartist as axisartist
from matplotlib import rcParams
def setup_page(ou... | {
"content_hash": "b7205f32882c8c6937c332eb3a3f7a75",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 139,
"avg_line_length": 35.295081967213115,
"alnum_prop": 0.6400371574547143,
"repo_name": "Harefoot/TurboQUALTX",
"id": "7246d7826e8cb40e824b43dba637c1aee9f8047f",
"size"... |
from __future__ import absolute_import, unicode_literals
from google.appengine.ext import ndb
from categoria.categoria_model import Categoria
from config.template_middleware import TemplateResponse
from gaecookie.decorator import no_csrf
from gaepermission.decorator import login_required, permissions
from routes.categ... | {
"content_hash": "00418aea7bde5711002aa9cab57b861b",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 67,
"avg_line_length": 33.96969696969697,
"alnum_prop": 0.7314897413024085,
"repo_name": "SamaraCardoso27/eMakeup",
"id": "d3fa6614635f6d2a22482f4bd29dcd808ea072b0",
"size"... |
"""This function makes tests to the views"""
from unittest import TestCase
from django.http import HttpRequest
from django.test import Client
from app.views import index
class HomePageViewTest(TestCase):
def test_home_page_returns_correct_html(self):
request = HttpRequest()
response = index(reque... | {
"content_hash": "60df8deb6f1568e3cf36608ad8af1cda",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 78,
"avg_line_length": 35.8,
"alnum_prop": 0.6319832402234636,
"repo_name": "xpostudio4/red-de-emprendimiento",
"id": "40cf6fa691c69ee94688ac2bb73c33a9ee0ef632",
"size": "1... |
"""Classes and functions for creating and comparing hash digests
Todo:
* Implement SHAKE and BLAKE
* Resist urge to call it "SHAKE'N BLAKE"
* Write better method for dealing with digest references that weren't
correctly provided.
"""
# ----------------------------Compatibility Imports-----------... | {
"content_hash": "eaa274fbb240f93ed91088ab52c30c06",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 80,
"avg_line_length": 27.42622950819672,
"alnum_prop": 0.588762701733413,
"repo_name": "jim-hart/sealant",
"id": "612282d9aa945663e4fa6127671a59703a268acd",
"size": "3346... |
"""
PySpark is the Python API for Spark.
Public classes:
- L{SparkContext<pyspark.context.SparkContext>}
Main entry point for Spark functionality.
- L{RDD<pyspark.rdd.RDD>}
A Resilient Distributed Dataset (RDD), the basic abstraction in Spark.
- L{Broadcast<pyspark.broadcast.Broadcast>}
A broa... | {
"content_hash": "93027569c77f45634e27a62700757e09",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 110,
"avg_line_length": 33.98076923076923,
"alnum_prop": 0.7408036219581211,
"repo_name": "zhangjunfang/eclipse-dir",
"id": "73fe7378ffa631b48d9322f2f0156491f584295e",
"siz... |
from django.conf.urls.defaults import url, patterns, include, handler404, handler500
urlpatterns = patterns("dialogos.views",
url(r"^comment/(?P<comment_id>.+?)/edit/$", "edit_comment",
name="edit_comment"),
url(r"^comment/(?P<comment_id>.+?)/delete/$", "delete_comment",
name="delete_comment")... | {
"content_hash": "a786fde227549acefcdf9cad1e05d470",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 84,
"avg_line_length": 39.72727272727273,
"alnum_prop": 0.6178489702517163,
"repo_name": "georgedorn/dialogos",
"id": "a0849348e17f12022bc3ed3e28b096d7a23b381a",
"size": "4... |
import numpy as np
from astropy import units as u
from astropy.coordinates.angle_utilities import angular_separation
from astropy.coordinates.builtin_frames import FK4, Galactic
from astropy.table import Table
from astropy.time import Time
from astropy.utils.data import get_pkg_data_contents
# the number of tests to ... | {
"content_hash": "878ddc9540b5b2fec61570dda0a105da",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 77,
"avg_line_length": 33.482142857142854,
"alnum_prop": 0.5914666666666667,
"repo_name": "larrybradley/astropy",
"id": "3e4733f438f7c33fa204173a0f3f956b08f26b8d",
"size": ... |
"""
Class for polling Ceilometer
This class provides means to requests for authentication tokens to be used with OpenStack's Ceilometer, Nova and RabbitMQ
"""
############# NOTICE ######################
# ProZaC is a fork of ZabbixCeilometer-Proxy (aka ZCP),
# which is Copyright of OneSource Consultoria... | {
"content_hash": "f787f82fcbee6554a3044fc834053c87",
"timestamp": "",
"source": "github",
"line_count": 237,
"max_line_length": 159,
"avg_line_length": 39.66244725738397,
"alnum_prop": 0.5591489361702128,
"repo_name": "hocchudong/ZabbixCeilometer-Proxy",
"id": "25f1c637e67bd9bf8fcea51e00fb24744324dc3... |
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import *
import os
import shutil
import sys
from commitsan.git import (REPOS_PATH, CalledProcessError,
git_cmd, git_revlist, mkdir_p)
from commitsan.worker import job
f... | {
"content_hash": "90b2070bb363347983f5b7e84d3b0eb4",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 66,
"avg_line_length": 25.973684210526315,
"alnum_prop": 0.6220871327254306,
"repo_name": "abusalimov/commitsan",
"id": "6112fd906ab8bdf14a1350997500d66b125a7688",
"size": ... |
from __future__ import unicode_literals
from indico.core.db.sqlalchemy import db
from indico.modules.events.models.persons import PersonLinkBase
from indico.util.string import format_repr, return_ascii
class SessionBlockPersonLink(PersonLinkBase):
"""Association between EventPerson and SessionBlock.
Also kn... | {
"content_hash": "8cc0db09a33ff0f041281a244707e6dc",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 93,
"avg_line_length": 30.5625,
"alnum_prop": 0.6840490797546013,
"repo_name": "mic4ael/indico",
"id": "63224c585bd113de16a787135a50908bac51d3e6",
"size": "1192",
"binary... |
"""Fix incompatible imports and module references."""
# Authors: Collin Winter, Nick Edds
# Local imports
from .. import fixer_base
from ..fixer_util import Name, attr_chain
MAPPING = {'StringIO': 'io',
'cStringIO': 'io',
'cPickle': 'pickle',
'__builtin__' : 'builtins',
'c... | {
"content_hash": "4856ceda518e86bffcd7a59019089cc1",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 80,
"avg_line_length": 39.44755244755245,
"alnum_prop": 0.5525616025527389,
"repo_name": "kpkhxlgy0/SublimeText3",
"id": "e1ad667f7bfab9f72e5d2a2f925fe4612e9f87c0",
"size"... |
import types
import sys
import traceback
from odict import odict
from node.interfaces import IRoot
from zope.interface import implementer
from zope.component import (
getUtility,
queryUtility,
getUtilitiesFor,
provideUtility,
)
from zope.component.interfaces import ComponentLookupError
from agx.core.in... | {
"content_hash": "3503f288d36c088c4a3a35c9e353ce64",
"timestamp": "",
"source": "github",
"line_count": 364,
"max_line_length": 155,
"avg_line_length": 31.88736263736264,
"alnum_prop": 0.5700008615490653,
"repo_name": "bluedynamics/agx.core",
"id": "002d222728126cecbe7d6050e7741df3d8130615",
"size"... |
"""Demo platform that has two fake binary sensors."""
from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass,
BinarySensorEntity,
)
from homeassistant.helpers.entity import DeviceInfo
from . import DOMAIN
async def async_setup_platform(hass, config, async_add_entities, discovery_info=No... | {
"content_hash": "fd8f6ecacf376a308a49afc9549d886c",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 86,
"avg_line_length": 27.301204819277107,
"alnum_prop": 0.5856134157105031,
"repo_name": "home-assistant/home-assistant",
"id": "8710308fc678e913a2ccd8abd77d881c53823fcb",
... |
import time
import json
import socket
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler, FileModifiedEvent
with open('config.json') as json_file:
config = json.load(json_file)
client_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
client_sock.connect((config['ip']... | {
"content_hash": "5624431a4d28d19f31fda0c1e8fd508a",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 163,
"avg_line_length": 41.45112781954887,
"alnum_prop": 0.47088699437692727,
"repo_name": "FarScripter/tChat",
"id": "c9fa31c972146a1a00e0c435ceb8af55e195f785",
"size": "... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caffe2.python import core, workspace
from future.utils import viewitems, viewkeys
def recurrent_net(
net, cell_net, inputs, initial_cell_inputs,
lin... | {
"content_hash": "290e8f26ed7d3d960dce23c31898dbef",
"timestamp": "",
"source": "github",
"line_count": 331,
"max_line_length": 80,
"avg_line_length": 40.4441087613293,
"alnum_prop": 0.6136550384701576,
"repo_name": "xzturn/caffe2",
"id": "e5b48894efbce2f16fcc5d441862e2e2a49f31bc",
"size": "13442",... |
import numpy as np
import astropy.units as u
import astropy.coordinates as coord
from astropy.coordinates import frame_transform_graph
from astropy.coordinates.matrix_utilities import matrix_transpose
__all__ = ["JhelumBonaca19"]
class JhelumBonaca19(coord.BaseCoordinateFrame):
"""
A Heliocentric spherical ... | {
"content_hash": "92243c1b6e8829bb928bd7d813bbb73d",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 83,
"avg_line_length": 40.87640449438202,
"alnum_prop": 0.6767454645409565,
"repo_name": "adrn/gary",
"id": "f61bdc9a9c03faf79081d33864e6f6c89a26295d",
"size": "3652",
"b... |
from distutils.version import StrictVersion
def test_project_metadata():
import circle_asset.version as v
StrictVersion(v.VERSION)
| {
"content_hash": "c74b308828b10c87bea7aecb5992113d",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 43,
"avg_line_length": 28,
"alnum_prop": 0.7785714285714286,
"repo_name": "prophile/circle-asset",
"id": "766e708a007e67feb3f0d8504340c43a62f41954",
"size": "140",
"binary... |
from datetime import datetime
from allauth.account.signals import user_signed_up
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from crumpet.profiles import constants
from crumpet.profiles.fields import PriceField, PercentField, AmountField
from crumpet.profiles.models impo... | {
"content_hash": "501b733a19617114a1bed0dc297d3771",
"timestamp": "",
"source": "github",
"line_count": 262,
"max_line_length": 110,
"avg_line_length": 27.614503816793892,
"alnum_prop": 0.5828610919143055,
"repo_name": "chrislombaard/cryptopuppet",
"id": "ee0bdd59ccd151f26e1f0e25d57505b13251c9af",
... |
import simplejson as json
import ijson
import requests
import copy
import os
import datetime
from PyQt4.QtCore import QObject, pyqtSignal
from path import Path
from ramed.app_logging import logger
from ramed.static import Constants
from ramed.tools.ramed_instance import RamedInstance
from ramed.tools.ramed_form_pdf_e... | {
"content_hash": "4fd2bc6a83a9074008a59feb135bd338",
"timestamp": "",
"source": "github",
"line_count": 257,
"max_line_length": 79,
"avg_line_length": 36.39688715953307,
"alnum_prop": 0.5839213170836006,
"repo_name": "yeleman/ramed-desktop",
"id": "2800973ac9afd9e82ebc3eff9258ac7564d9dfb6",
"size":... |
import os
import sys
import time
from threading import Thread
import npyscreen
from docker.errors import DockerException
from npyscreen import notify_confirm
from vent.api.system import System
from vent.helpers.logs import Logger
from vent.helpers.meta import Containers
from vent.helpers.meta import Cpu
from vent.hel... | {
"content_hash": "25238c1893911e7e839a573aa4c2eba7",
"timestamp": "",
"source": "github",
"line_count": 401,
"max_line_length": 92,
"avg_line_length": 43.069825436408976,
"alnum_prop": 0.4969602223380233,
"repo_name": "cglewis/vent",
"id": "7048641ffd8a72ce81a6324521f74da29d9be98e",
"size": "17271"... |
import os
import cPickle as pickle
import numpy as np
from config import *
from PreprocessedData import PreprocessedData, Seq
def load_songs(configs):
# Load 173? chord sequences from Rolling Stone "500 Greatest Songs of All Time"
print configs['corpus']
if configs['corpus'] == 'bach':
fname = ... | {
"content_hash": "ab8fefb02c9d2721416c875c03205209",
"timestamp": "",
"source": "github",
"line_count": 315,
"max_line_length": 98,
"avg_line_length": 28.70793650793651,
"alnum_prop": 0.5789008072542298,
"repo_name": "czhuang/ChordRipple",
"id": "96260bf987dd82aae8d9c68d9757952c7601fa95",
"size": "... |
BOT_NAME = 'CNSpider'
SPIDER_MODULES = ['CNSpider.spiders']
NEWSPIDER_MODULE = 'CNSpider.spiders'
RANDOMIZE_DOWNLOAD_DELAY = True
COOKIES_ENABLED = False
RETRY_ENABLED = False
DOWNLOAD_DELAY = 2
SCHEDULER = "scrapy_redis.scheduler.Scheduler"
SCHEDULER_PERSIST = True
DOWNLOADER_MIDDLEWARES = {
'scrapy.con... | {
"content_hash": "464dcfe60c8157bf377518c39129f198",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 83,
"avg_line_length": 24.08,
"alnum_prop": 0.7458471760797342,
"repo_name": "4xin/scrapy-study",
"id": "837b2f59341e1e3c0c65c583669382d684de3c32",
"size": "862",
"binary... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Remove StaticInterface
# XXX PLEASE uncomment this in production
from django.contrib.contenttypes.models import ContentTyp... | {
"content_hash": "af80297187116d9b8fb30b6ecf871024",
"timestamp": "",
"source": "github",
"line_count": 221,
"max_line_length": 189,
"avg_line_length": 76.61085972850678,
"alnum_prop": 0.5619868879570019,
"repo_name": "mozilla/inventory",
"id": "e4bd8f57b68ff489d3f92e27bd06479d9ae19fe8",
"size": "1... |
from __future__ import unicode_literals, print_function
from django.db import migrations
def forwards_func(apps, schema_editor):
CognateClass = apps.get_model('lexicon', 'CognateClass')
fields = ['gloss_in_root_lang',
'loanword',
'loan_source',
'loan_notes']
print... | {
"content_hash": "2cd1720a1320b143b0a31db350cbaa17",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 71,
"avg_line_length": 28.137931034482758,
"alnum_prop": 0.625,
"repo_name": "lingdb/CoBL-public",
"id": "20ad85de78f4b478c74cd05741aba3891292f47a",
"size": "840",
"binar... |
"""
RenderPipeline
Copyright (c) 2014-2016 tobspr <tobias.springer1@gmail.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 right... | {
"content_hash": "c3caed86fa2378f3180384ddd60d11e1",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 89,
"avg_line_length": 36.83606557377049,
"alnum_prop": 0.6433021806853583,
"repo_name": "croxis/SpaceDrive",
"id": "5c95c2da25495ae3bfed158a71313989bbc9bf01",
"size": "44... |
"""
Tick locating and formatting
============================
This module contains classes to support completely configurable tick locating
and formatting. Although the locators know nothing about major or minor
ticks, they are used by the Axis class to support major and minor tick
locating and formatting. Generic t... | {
"content_hash": "dcafc6449c49d741efc3ccefff96773b",
"timestamp": "",
"source": "github",
"line_count": 1792,
"max_line_length": 104,
"avg_line_length": 31.013392857142858,
"alnum_prop": 0.5401972074276666,
"repo_name": "lthurlow/Network-Grapher",
"id": "e6c7f4d2d04c7e638ec6fc843d69b422fe35ef59",
"... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('geral', '0002_auto_20170914_1207'),
]
operations = [
migrations.CreateModel(
name='Dispositivos',
fields=[
(... | {
"content_hash": "52d87ccaf7113fe3eeb35b6f35d8b3f0",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 117,
"avg_line_length": 32.04,
"alnum_prop": 0.5617977528089888,
"repo_name": "anselmobd/fo2",
"id": "a9a4fe3a3124122c0227bfc41cc1771aed28ed04",
"size": "876",
"binary": ... |
from datetime import datetime
from pandas.compat import range, long, zip
from pandas import compat
import re
import numpy as np
from pandas.core.algorithms import unique
from pandas.tseries.offsets import DateOffset
from pandas.util.decorators import cache_readonly
import pandas.tseries.offsets as offsets
import pand... | {
"content_hash": "2b9995f8ae2405836323a2b60317ee00",
"timestamp": "",
"source": "github",
"line_count": 1089,
"max_line_length": 123,
"avg_line_length": 28.52617079889807,
"alnum_prop": 0.5296314179945276,
"repo_name": "dssg/wikienergy",
"id": "54b29b164130927e4571cd1380d56e6f3c640d17",
"size": "31... |
"""
.. moduleauthor:: Ulf Krumnack
.. module:: qtgui.widgets.datasource
This module contains widgets for viewing and controlling
:py:class:`Datasource`s. It aims at providing support for all
abstract interfaces defined in
`datasource.datasource`.
"""
# standard imports
from typing import Union
import logging
# Qt i... | {
"content_hash": "cf13af7910ca4f4bf71baa1d2dca2753",
"timestamp": "",
"source": "github",
"line_count": 716,
"max_line_length": 79,
"avg_line_length": 38.002793296089386,
"alnum_prop": 0.6489525909592062,
"repo_name": "Petr-By/qtpyvis",
"id": "d8112dd6fe99263e2eb8e9c1526cba27afc60963",
"size": "272... |
"""Functions for TML layout that are used in the grammar to construct DOM-like
node objects used in the 164 layout engine.
"""
def createNode(name, attributes=None, children=None):
"""Creates a DOM-like node object, using the 164 representation so that
the node can be processed by the 164 layout engine.
"... | {
"content_hash": "1dd0f802644791c2a35610b96c1a9a69",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 78,
"avg_line_length": 38.578947368421055,
"alnum_prop": 0.684856753069577,
"repo_name": "michelle/sink",
"id": "3f1a174cef5caa300f5e8dde7fdb33469797d15e",
"size": "733",
... |
import pika
import json
import base64
import time
import os
import redis
import logging
import farm_template_py3
global connection
class Remote_Interface_server():
def __init__(self, redis_handle ):
self.redis = redis_handle
self.cmds = {}
self.cmds["PING"] = True
... | {
"content_hash": "9c9777e189b849e602267ae09f6d7507",
"timestamp": "",
"source": "github",
"line_count": 323,
"max_line_length": 141,
"avg_line_length": 31.56656346749226,
"alnum_prop": 0.5139270302079246,
"repo_name": "glenn-edgar/local_controller_2",
"id": "6185602cf6db908d922a4de113762b6d76c9fb1d",... |
value = True
if value:
print("Got true")
else:
print("Got else")
value = False
if value:
print("Got true")
else:
print("Got else")
result = 3
if result == 1:
print("Got true")
elif result == 2:
print("Got else")
else:
print("Got if else") | {
"content_hash": "286a35aa3c9c65994115adc4a75a3d96",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 24,
"avg_line_length": 14.105263157894736,
"alnum_prop": 0.5895522388059702,
"repo_name": "Bigsby/HelloLanguages",
"id": "4a382aa43cd52189dcb3b9f284c202f75a1d6689",
"size":... |
from aquilon.exceptions_ import ArgumentError
from aquilon.aqdb.model import (Personality, PersonalityParameter,
ParamDefinition, ArchetypeParamDef, Feature)
from aquilon.worker.broker import BrokerCommand
from aquilon.worker.dbwrappers.change_management import ChangeManagement
from aqui... | {
"content_hash": "0d418f295595fa213c314b3be85c986e",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 102,
"avg_line_length": 43.35443037974684,
"alnum_prop": 0.6058394160583942,
"repo_name": "quattor/aquilon",
"id": "4e367fcb97cb421a4ee733a922d11e829291e6a5",
"size": "4134... |
import ast
from contextlib import contextmanager
def add_scope_context(node):
"""Provide to scope context to all nodes"""
return ScopeTransformer().visit(node)
class ScopeMixin(object):
"""
Adds a scope property with the current scope (function, module)
a node is part of.
"""
scopes = []... | {
"content_hash": "871823b74227f662dcb9932b879c01ce",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 74,
"avg_line_length": 29.432098765432098,
"alnum_prop": 0.5708892617449665,
"repo_name": "lukasmartinelli/py14",
"id": "b6bc8b5f6505cecbf99d8aa649e08b2f74044d01",
"size": ... |
from jim.protocol import JimMessage, JimResponse
from jim.errors import MandatoryKeyError
from jim.config import MESSAGE
from PyQt5.QtCore import QObject, pyqtSignal
class Receiver:
''' Класс-получатель информации из сокета
'''
def __init__(self, sock, request_queue):
# запоминаем очер... | {
"content_hash": "37dbc46cc745355f2fa71cc1adf2e29b",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 106,
"avg_line_length": 31.814285714285713,
"alnum_prop": 0.5383924562191289,
"repo_name": "OOPSA45/Python-learn-",
"id": "3e3fe9723cdbd61be9f77ac6d8474c1bdfb2d7f9",
"size"... |
"""Stream-related things."""
__all__ = ['StreamReader', 'StreamWriter', 'StreamReaderProtocol',
'open_connection', 'start_server',
'IncompleteReadError',
]
import socket
if hasattr(socket, 'AF_UNIX'):
__all__.extend(['open_unix_connection', 'start_unix_server'])
from . import co... | {
"content_hash": "576c649cda43374b88d5de4d2d593fdd",
"timestamp": "",
"source": "github",
"line_count": 485,
"max_line_length": 79,
"avg_line_length": 33.338144329896906,
"alnum_prop": 0.5854412765167913,
"repo_name": "OptimusGitEtna/RestSymf",
"id": "c77eb606c2f9f1f8d1e71d08629eeaceaed8a9e8",
"siz... |
import sys
import wx
from Experimenter.GUI.STAverage import PyroSTAFrame
def launch_sta_app(port=6878):
app = wx.PySimpleApp()
frame = PyroSTAFrame(pyro_port=port)
frame.Show()
app.SetTopWindow(frame)
app.MainLoop()
if __name__ == '__main__':
port = int(sys.argv[-1])
launch_sta_app(port)
| {
"content_hash": "7a7e279fccbdebf1cc7a6e4db2ddc831",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 51,
"avg_line_length": 22.785714285714285,
"alnum_prop": 0.664576802507837,
"repo_name": "chrox/RealTimeElectrophy",
"id": "7c63edb6e45f8802bb46649973db3fa31284c7e4",
"size... |
import foauth.providers
class TwentyThreeAndMe(foauth.providers.OAuth2):
# General info about the provider
alias = '23andme'
name = '23andMe'
provider_url = 'https://23andme.com/'
docs_url = 'https://api.23andme.com/docs/'
category = 'Genealogy'
# URLs to interact with the API
authoriz... | {
"content_hash": "f55dc0f909e2dbea9e2440248f04fdd9",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 94,
"avg_line_length": 47.22222222222222,
"alnum_prop": 0.6705882352941176,
"repo_name": "foauth/oauth-proxy",
"id": "8064af15eaa7f1f02d1cb802c904b912fcc56b8d",
"size": "17... |
'''
A library of parsing functions for fixlets.
'''
import json
import cgi
import re
'''
The regular expression for matching the format of an attribute in a directory
entry.
'''
ATTR_REGEX = '\w+: (.*)'
'''
The attributes present in a file's entry on the gather site, in order.
See the function 'parse_directory(text)... | {
"content_hash": "10b6d37078784d369afdc67486f63aaf",
"timestamp": "",
"source": "github",
"line_count": 231,
"max_line_length": 109,
"avg_line_length": 33.489177489177486,
"alnum_prop": 0.5900982419855222,
"repo_name": "bigfix/fixlet-historian",
"id": "8313bedfc3f2f8e2eb07be45852b9d7eac6f4b46",
"si... |
from classes_pong import Paddle, Ball, ScoreArea
import pygame
from pygame.locals import *
#Screen Constants
SCREEN_WIDTH = 800
SCREEN_HEIGHT = 600
SCREEN_SIZE = (SCREEN_WIDTH, SCREEN_HEIGHT)
#Screen area constants
SCORES_HEIGHT = 100
PLAY_AREA = (0, SCREEN_WIDTH, SCORES_HEIGHT, SCREEN_HEIGHT)
#Other Game constants
... | {
"content_hash": "c75d64e41477f327619a640b1835ffce",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 76,
"avg_line_length": 26.016129032258064,
"alnum_prop": 0.6174829510229386,
"repo_name": "anshbansal/general",
"id": "7db6751d5d530d3dfccdb691054f62d4c826cb0a",
"size": "1... |
'''
Return data to an etcd server or cluster
:depends: - python-etcd
In order to return to an etcd server, a profile should be created in the master
configuration file:
.. code-block:: yaml
my_etcd_config:
etcd.host: 127.0.0.1
etcd.port: 4001
It is technically possible to configure etcd without usi... | {
"content_hash": "0418e8a4e7ddad691451ecf3ac8a3f71",
"timestamp": "",
"source": "github",
"line_count": 222,
"max_line_length": 80,
"avg_line_length": 25.40990990990991,
"alnum_prop": 0.6234710157773444,
"repo_name": "stephane-martin/salt-debian-packaging",
"id": "3e0e75f67bf5650ed1658c13037513a903cb... |
from nose.tools import with_setup
from testconfig import config
from pyvcloud import vcloudair
from pyvcloud.vcloudair import VCA
import time
class TestCatalog:
def __init__(self):
self.vca = None
self.login_to_vcloud()
def login_to_vcloud(self):
"""Login to vCloud"""
usern... | {
"content_hash": "407f497f42f39fbe92d6ed8bd93141ac",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 159,
"avg_line_length": 35.948905109489054,
"alnum_prop": 0.5981725888324874,
"repo_name": "cloudify-cosmo/pyvcloud",
"id": "dd3469f935539d4a65d1a5064aac1e2f68c3f247",
"si... |
import logging
import os
from contextlib import contextmanager
from functools import partial
from typing import (
TYPE_CHECKING,
Any,
Callable,
Dict,
Iterable,
List,
Optional,
TextIO,
Tuple,
Union,
cast,
)
from funcy import compact, lremove
from rich.rule import Rule
from ri... | {
"content_hash": "452b7acbbdb6146cafafc2492bd3212d",
"timestamp": "",
"source": "github",
"line_count": 284,
"max_line_length": 78,
"avg_line_length": 28.535211267605632,
"alnum_prop": 0.6027887462981244,
"repo_name": "efiop/dvc",
"id": "613906b1ae21bfa6b3395ca64f97adfeefc2b343",
"size": "8104",
... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('trips', '0005_auto_20150725_1629'),
]
operations = [
migrations.AlterField(
model_name='calendar',
name='service_id',
... | {
"content_hash": "a99f0c39733f2d2b436a0f1eec76179d",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 90,
"avg_line_length": 28.857142857142858,
"alnum_prop": 0.5792079207920792,
"repo_name": "renanalencar/hermes",
"id": "06d659b4aa1054046b8fd0f6cb06d4ec166c043f",
"size": "... |
'''
Script "suite" for grabbing and analyzing files from the NCBI database. Generally, the program will
take a list of accession numbers and retrieve either the protein or nucleotide sequence and can save the
file in either genbank or fasta form. The file containing the accession numbers should be in csv format
with a ... | {
"content_hash": "b7bb6fe9c6b522126534451881eec131",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 113,
"avg_line_length": 37.554054054054056,
"alnum_prop": 0.7351565311263044,
"repo_name": "chibbargroup/CentralRepository",
"id": "9f51215b41bcd7c02fc113930451365219a32e62",... |
import glance_store
from oslo_log import log as logging
from glance.api import authorization
from glance.api import policy
from glance.api import property_protections
from glance.common import exception
from glance.common import property_utils
from glance.common import store_utils
import glance.db
import glance.domain... | {
"content_hash": "780c0f4b7a4ec2576b9c75518e1a5c0a",
"timestamp": "",
"source": "github",
"line_count": 245,
"max_line_length": 78,
"avg_line_length": 47.12244897959184,
"alnum_prop": 0.6733650931139021,
"repo_name": "vuntz/glance",
"id": "bc12665de4a31310b536606837e1750925d5217a",
"size": "12207",... |
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from builtins import range
from future import standard_library
standard_library.install_aliases()
import sys
import argparse
PYTHON_VERSION = sys.version_info[:3]
PY2 = ... | {
"content_hash": "18a258124847ba086c22eedb02bc3279",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 73,
"avg_line_length": 29.394957983193276,
"alnum_prop": 0.5943396226415094,
"repo_name": "miqui/python-hpOneView",
"id": "39ebd2b2511bb0845b02b76812372cc2a3b52097",
"size... |
from __future__ import print_function
import pycurl, sys, time, logging
from os import unlink, path
from threading import Thread
from decrypt import *
if sys.version_info[0] < 3:
from StringIO import StringIO
from tkMessageBox import showinfo as msgbox
from urllib import unquote
from urllib import urlencode
else:... | {
"content_hash": "e3d0317d64b6e8985d98634515428bfc",
"timestamp": "",
"source": "github",
"line_count": 242,
"max_line_length": 118,
"avg_line_length": 27.00826446280992,
"alnum_prop": 0.6739596083231334,
"repo_name": "jkcgs/anime-downloader-es",
"id": "171ec21ff5679c64508c4aafa2a723864d8676e9",
"s... |
"""
Test the calcload.py utility and function calc_max_load()
"""
from tests.data import voyager_h5, voyager_fil
from blimpy.calcload import cmd_tool, calc_max_load
def test_calcload():
r""" Test the calcload command line tool """
args = [voyager_h5]
cmd_tool(args)
args = ['-v', voyager_fil]
cmd_to... | {
"content_hash": "36e8208262e178f98adb70e8280e454d",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 57,
"avg_line_length": 25.476190476190474,
"alnum_prop": 0.6317757009345795,
"repo_name": "UCBerkeleySETI/blimpy",
"id": "cc82923ec3653486df41dc5676da4533aa7abaee",
"size":... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('taxbrain', '0064_auto_20150314_2132'),
]
operations = [
migrations.RenameField(
model_name='taxsaveinputs',
old_name='person... | {
"content_hash": "69abfe88fd5c994860652355252056f4",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 54,
"avg_line_length": 28.325581395348838,
"alnum_prop": 0.5328407224958949,
"repo_name": "nolanzandi/webapp-public",
"id": "8c83030ebd587a7e6818d1f3ad6f60b36d7ff8f2",
"siz... |
"""
This module provides a client class for TSDB.
"""
import io
import copy
import json
import logging
import gzip
from baidubce import bce_client_configuration
from baidubce import utils
from baidubce.auth import bce_v1_signer
from baidubce.bce_base_client import BceBaseClient
from baidubce.http import bce_http_clie... | {
"content_hash": "119ae585ce542cc50a8aebdb1911734b",
"timestamp": "",
"source": "github",
"line_count": 273,
"max_line_length": 99,
"avg_line_length": 31.384615384615383,
"alnum_prop": 0.5510037348272643,
"repo_name": "baidubce/bce-sdk-python",
"id": "aaefbb8547610ef16d4765858ad905271c37adaa",
"siz... |
from django.conf import settings
from django.urls import path
from .export import EXPORT_MEDIA_PREFIX
from .views import ExportFileDetailView
MEDIA_PATH = settings.MEDIA_URL
# Split off domain and leading slash
if MEDIA_PATH.startswith("http"):
MEDIA_PATH = MEDIA_PATH.split("/", 3)[-1]
else:
MEDIA_PATH = MEDI... | {
"content_hash": "c3a8da0d95eacfc1261dfd475dc4a78c",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 67,
"avg_line_length": 24.80952380952381,
"alnum_prop": 0.6852207293666027,
"repo_name": "fin/froide",
"id": "bced463d0b2468845e8d2b5402d66fd7689e83e6",
"size": "521",
"b... |
from .kernel_disk_workload import KernelDiskWorkload
from ...resources.resource import AbstractResource
from ...utils.override import overrides
from .abstract_system_board import AbstractSystemBoard
from ...isas import ISA
from m5.objects import (
Pc,
AddrRange,
X86FsLinux,
Addr,
X86SMBiosBiosInfor... | {
"content_hash": "878f4a043070fa1666d3d782524edb9c",
"timestamp": "",
"source": "github",
"line_count": 292,
"max_line_length": 79,
"avg_line_length": 32.05821917808219,
"alnum_prop": 0.5797457536587971,
"repo_name": "gem5/gem5",
"id": "6761bdb3fa1422dfe4db7b8618c9f8657f0fa6bf",
"size": "10912",
... |
from .error import BetTooLargeError, BetTooSmallError
class Players(object):
""" deals with the player holdings and results
all results are returned as (betting amount, is_all_in)
"""
def __init__(self, holdings):
self.cards = None
self.holdings = holdings
self.alive = True
... | {
"content_hash": "c3d91ea43fde5855e57cbad3f03895f6",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 80,
"avg_line_length": 28.49019607843137,
"alnum_prop": 0.5554026152787337,
"repo_name": "tychung84/poker_tester",
"id": "5ba178ecfe45c7b16be05e301cde83a52fb990b6",
"size":... |
from ._abstract import AbstractScraper
class G750g(AbstractScraper):
@classmethod
def host(cls):
return "750g.com"
def title(self):
return self.schema.title()
def total_time(self):
return self.schema.total_time()
def yields(self):
return self.schema.yields()
... | {
"content_hash": "dc48902f1d3ba5e0592da5221feffd92",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 41,
"avg_line_length": 20.5,
"alnum_prop": 0.632404181184669,
"repo_name": "hhursev/recipe-scraper",
"id": "4aab52bca735df0eade1ebb6c95642acc98816d6",
"size": "574",
"bin... |
import traceback
from math import *
from PyQt5.QtCore import QEvent, QPoint, Qt, QPointF
from PyQt5.QtGui import QColor, QLinearGradient, QTransform, QPen, QPainter, QBrush
from PyQt5.QtWidgets import QDialog, QInputDialog, QMessageBox, QWidget
from Business.SketchActions import *
from Data.Style import BrushType
fro... | {
"content_hash": "c0043df9b5027938d833bd4308d1d8d1",
"timestamp": "",
"source": "github",
"line_count": 496,
"max_line_length": 133,
"avg_line_length": 30.086693548387096,
"alnum_prop": 0.6705756215238223,
"repo_name": "pracedru/PracedruDesign",
"id": "c0ec2407b30168938bc820707515343971d96849",
"si... |
import sys
IS_PYTHON3 = sys.version_info >= (3, 0)
if IS_PYTHON3:
BASESTRING_TYPES = str
else:
BASESTRING_TYPES = (str, unicode)
def _unicode(item):
if IS_PYTHON3:
return str(item)
else:
return unicode(item) | {
"content_hash": "cecc5e6c0158d32a3d832a0ad88255cc",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 39,
"avg_line_length": 16.142857142857142,
"alnum_prop": 0.668141592920354,
"repo_name": "GoUbiq/pyexchange",
"id": "f1ee45da131f45ac58a6c2637c716173d254f47f",
"size": "226... |
import json
import select
import socket
import settings
from pymongo import MongoClient
from bson import json_util
bufferSize = 1024 # whatever you need
print("Starting ndlogger daemon")
print("UDP target IP:", settings.LOG_SERVER_IP)
print("UDP target port:", settings.LOG_SERVER_PORT)
#start
s = socket.socket(soc... | {
"content_hash": "5486e8e40667e9dee97cbe6423adba78",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 87,
"avg_line_length": 23.1875,
"alnum_prop": 0.6720575022461814,
"repo_name": "russenreaktor/tdlogger",
"id": "b55f0a2a4b325065e0bceabe2fccf8c1afd08310",
"size": "1136",
... |
import sys
import os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '... | {
"content_hash": "99d6a4e16dcd2090abf84179a961eb9b",
"timestamp": "",
"source": "github",
"line_count": 277,
"max_line_length": 80,
"avg_line_length": 32.55595667870036,
"alnum_prop": 0.7039254823685961,
"repo_name": "spoqa/tsukkomi",
"id": "c34c0deff24d9f375254f560c6a56c8f89bfd02b",
"size": "9462"... |
class FacebookCanvasMiddleware(object):
def process_response(self, request, response):
if 'signed_request' in request.REQUEST:
response.set_cookie('signed_request', request.REQUEST['signed_request'])
response['P3P'] = 'CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"... | {
"content_hash": "640587c96436de445afcde9130558767",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 97,
"avg_line_length": 44.875,
"alnum_prop": 0.6601671309192201,
"repo_name": "gsiegman/python-facebook",
"id": "73c13ddaa1abf40735bc38ca513a6c780aaa6ffc",
"size": "359",
... |
import discord
from discord.voice_client import StreamPlayer
from roboto.commands import dispatcher, TaskState, Commands
class ServerState(object):
def __init__(self, server_id):
from roboto import text
self.server_id = server_id
self._voice_channel_id = None
self._media_player = ... | {
"content_hash": "bcfb63c715d11536f0c3903d2a70134f",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 79,
"avg_line_length": 28.043478260869566,
"alnum_prop": 0.6134366925064599,
"repo_name": "leighmacdonald/roboto",
"id": "ca1324244e6e4bc1b68df3c18c8afa8ebf0ba863",
"size":... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.