text stringlengths 4 1.02M | meta dict |
|---|---|
import logging
import numpy as np
import pandas as pd
from advantages import compute_advantages
from augmenter import augment_with_advantages
from tools.metadata import get_last_patch
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
def _dataset_to_features(dataset_df, advantages=None):
... | {
"content_hash": "395d8211414d2b95472a95e6240d3cb2",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 100,
"avg_line_length": 35.6530612244898,
"alnum_prop": 0.6202060675443618,
"repo_name": "andreiapostoae/dota2-predictor",
"id": "6f0c9d62d9bf96424f49109103c90605b97ccdec",
... |
"""This example gets all child ad units of the effective root ad unit."""
# Import appropriate modules from the client library.
from googleads import ad_manager
def main(client):
# Initialize appropriate services.
network_service = client.GetService('NetworkService', version='v201805')
inventory_service = cli... | {
"content_hash": "d042df8cf80f9ee84c8afdcc8f721751",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 79,
"avg_line_length": 38.69047619047619,
"alnum_prop": 0.6923076923076923,
"repo_name": "Aloomaio/googleads-python-lib",
"id": "37f23fea29e5dea24ea635e8b8eb2354de35737a",
... |
"""Accesses the google.monitoring.v3 AlertPolicyService API."""
import functools
import pkg_resources
import warnings
from google.oauth2 import service_account
import google.api_core.gapic_v1.client_info
import google.api_core.gapic_v1.config
import google.api_core.gapic_v1.method
import google.api_core.grpc_helpers
... | {
"content_hash": "afd3c9f2f8e88cce87889523b20986aa",
"timestamp": "",
"source": "github",
"line_count": 583,
"max_line_length": 160,
"avg_line_length": 46.945111492281306,
"alnum_prop": 0.5872702692827652,
"repo_name": "tseaver/gcloud-python",
"id": "5c73e8e88a19fa7d1732d4a9274a82656a7b7f14",
"size... |
import datetime
from django.test import TestCase
from haystack import connections
from haystack.inputs import Exact
from haystack.models import SearchResult
from haystack.query import SQ
from core.models import MockModel, AnotherMockModel
class ElasticsearchSearchQueryTestCase(TestCase):
def setUp(self):
... | {
"content_hash": "cd9f8355ecda066f9b59af66803c2bed",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 251,
"avg_line_length": 49.170212765957444,
"alnum_prop": 0.6245492571758258,
"repo_name": "zhangtianyi1234/django-haystack",
"id": "e44ed674614ffcf78dad532eaa492980fe2905db... |
"""
disthelpers
-----------
The ``guidata.disthelpers`` module provides helper functions for Python
package distribution on Microsoft Windows platforms with ``py2exe`` or on
all platforms thanks to ``cx_Freeze``.
"""
import sys
import os
import os.path as osp
import shutil
import traceback
import atexit
import imp
... | {
"content_hash": "d48bbeeac01963e7c147f21b9675a416",
"timestamp": "",
"source": "github",
"line_count": 652,
"max_line_length": 107,
"avg_line_length": 42.69631901840491,
"alnum_prop": 0.5429628565270493,
"repo_name": "dragondjf/QMarkdowner",
"id": "806999fbdfdb4e9474c92249372003910c6f5627",
"size"... |
import ipaddress
import pyroute2
from octavia.common import constants as consts
from octavia.common import exceptions
def _find_interface(ip_address, rtnl_api, normalized_addr):
"""Find the interface using a routing netlink API.
:param ip_address: The IP address to search with.
:param rtnl_api: A pyrou... | {
"content_hash": "d5aeeb9f5b14f5244a1df9aefec7cb30",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 79,
"avg_line_length": 45.16901408450704,
"alnum_prop": 0.6245712503897723,
"repo_name": "openstack/octavia",
"id": "6311b695e694150f7cc5b7b540b4f5b9f2beb6ea",
"size": "380... |
"""
tinykit
-------
A toolkit for TinyDB with additional features (transaction, model, etc).
"""
import codecs
import os
import re
from setuptools import setup
from setuptools import find_packages
def find_version(*file_paths):
here = os.path.abspath(os.path.dirname(__file__))
with codecs.open(os.path.join(h... | {
"content_hash": "23f3e189cbd931b4650d54766ad0380a",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 72,
"avg_line_length": 28.37735849056604,
"alnum_prop": 0.5957446808510638,
"repo_name": "iromli/timo",
"id": "7a8be24256fb383c139297b9cc74866e1c2f59f7",
"size": "1504",
... |
from django.core.management.base import BaseCommand
class Command(BaseCommand):
def handle(self, **options):
self.stdout.write('Working...')
self.stdout.flush()
self.stdout.write('OK')
| {
"content_hash": "2b02220b419cec4b990777ecb6e252fa",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 51,
"avg_line_length": 26.875,
"alnum_prop": 0.6604651162790698,
"repo_name": "elena/django",
"id": "bafc30d1287825d215b151cfb0f9c3299771c1f3",
"size": "215",
"binary": fa... |
import numpy as np
from rl_coach.core_types import ObservationType
from rl_coach.filters.observation.observation_filter import ObservationFilter
from rl_coach.spaces import ObservationSpace
class ObservationClippingFilter(ObservationFilter):
"""
Clips the observation values to a given range of values.
Fo... | {
"content_hash": "e7eecc4cda0bbb4af4fafe522220f5db",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 108,
"avg_line_length": 43.3,
"alnum_prop": 0.7259430331023865,
"repo_name": "NervanaSystems/coach",
"id": "8c5c0ae44f82d130ceee9228dd797bb6d8669bfb",
"size": "1891",
"bi... |
from __future__ import division
import copy
import itertools as it
import numpy as np
import networkx as nx
from pgmpy.extern.six.moves import filter, range
from pgmpy.inference import Inference
from pgmpy.models import MarkovModel
from pgmpy.factors.discrete import DiscreteFactor
class Mplp(Inference):
"""
... | {
"content_hash": "fad2ee855de4d8c4bbf090ef5db6f8f0",
"timestamp": "",
"source": "github",
"line_count": 507,
"max_line_length": 128,
"avg_line_length": 50.34516765285996,
"alnum_prop": 0.5990989226248775,
"repo_name": "abinashpanda/pgmpy",
"id": "1a8b776e43823c62433e3e6acc50ce74193b46fe",
"size": "... |
from django.conf.urls import include, url
from django.urls import path
from django.contrib import admin
admin.autodiscover()
import hello.views
# Examples:
# url(r'^$', 'gettingstarted.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
urlpatterns = [
url(r'^$', hello.views.index, name='index'),... | {
"content_hash": "5cd9f4b7108602acadb3c2cf3e357cf8",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 55,
"avg_line_length": 23.764705882352942,
"alnum_prop": 0.6683168316831684,
"repo_name": "joshfriend/heroku-buildpack-python",
"id": "36492ed3cfea168237908825cb6ac0b8b4207d4... |
class Solution:
# @param {integer[][]} matrix
# @param {integer} target
# @return {boolean}
def searchMatrix(self, matrix, target):
nr = len(matrix)
nc = len(matrix[0])
for row in matrix:
lo = 0
hi = nc-1
if target < row[lo]:
b... | {
"content_hash": "497652882fe252898b9a8ddc66f61d67",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 43,
"avg_line_length": 28.782608695652176,
"alnum_prop": 0.3972809667673716,
"repo_name": "saai/LeetcodePythonSolutions",
"id": "ea4eafe2ebab7f99a3e0a0ecddb1f5edcd55aa31",
... |
import sys, 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.abspath('.'))
# -- General configurat... | {
"content_hash": "9f7a38575d579aebf3c3a3bcc8e912c9",
"timestamp": "",
"source": "github",
"line_count": 203,
"max_line_length": 80,
"avg_line_length": 32.80788177339902,
"alnum_prop": 0.7079579579579579,
"repo_name": "nek4life/pyramid_assetviews",
"id": "80712ea98c4b9a6f0f0d6e8494d770ec95f91867",
"... |
import numpy as np
# Local imports
from simple_rl.mdp.StateClass import State
''' GymStateClass.py: Contains a State class for Gym. '''
class GymState(State):
''' Gym State class '''
def __init__(self, data=[], is_terminal=False):
self.data = data
State.__init__(self, data=data, is_terminal=... | {
"content_hash": "68115689cb2cde42c497e3a3736e9010",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 71,
"avg_line_length": 30.210526315789473,
"alnum_prop": 0.6114982578397212,
"repo_name": "david-abel/simple_rl",
"id": "638a508c070cceb8da5deef69d6cd5f4102f633a",
"size": ... |
import _plotly_utils.basevalidators
class YcalendarValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(self, plotly_name="ycalendar", parent_name="mesh3d", **kwargs):
super(YcalendarValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | {
"content_hash": "b11dc6fd7b90c86a9242319178913d77",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 80,
"avg_line_length": 31.96969696969697,
"alnum_prop": 0.3886255924170616,
"repo_name": "plotly/python-api",
"id": "e30ff3acc112c028bcbb77600a4107d206ace312",
"size": "105... |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "Lag1Trend", cycle_length = 5, transform = "Difference", sigma = 0.0, exog_count = 20, ar_order = 12); | {
"content_hash": "d5c6f962deaa0b6838033f496946a78f",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 165,
"avg_line_length": 37.857142857142854,
"alnum_prop": 0.7056603773584905,
"repo_name": "antoinecarme/pyaf",
"id": "5a97c3d42354bad7c4e25206ba695365c00c2d40",
"size": "26... |
"""OAuth2 implementations for Toon."""
from __future__ import annotations
from typing import Any, cast
from homeassistant.core import HomeAssistant
from homeassistant.helpers import config_entry_oauth2_flow
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from . import config_flow
def regis... | {
"content_hash": "9332a93d7d294f0db717f67590fcb581",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 88,
"avg_line_length": 31.115107913669064,
"alnum_prop": 0.5824277456647399,
"repo_name": "w1ll1am23/home-assistant",
"id": "95cde38621501c5f88101497cd7862375252d257",
"si... |
from time import time as now, sleep
#apetools
from apetools.parsers import oatbran
from basepollster import BasePollster, CSV_JOIN, ZERO
class RssiPollerEnum(object):
"""
A Holder of rssi-poller constants
"""
__slots__ = ()
rssi = 'RSSI'
rssipoller = 'rssipoller'
# end class RssiPollerEnum
... | {
"content_hash": "83d49ed04f0de3a4d962d7f9a7dd130d",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 71,
"avg_line_length": 26.918032786885245,
"alnum_prop": 0.5627283800243605,
"repo_name": "rsnakamura/oldape",
"id": "8225b55ee2580632c90813754d4d8ab2a71c91eb",
"size": "16... |
from braintree.account_updater_daily_report import AccountUpdaterDailyReport
from braintree.configuration import Configuration
from braintree.connected_merchant_paypal_status_changed import ConnectedMerchantPayPalStatusChanged
from braintree.connected_merchant_status_transitioned import ConnectedMerchantStatusTransitio... | {
"content_hash": "5c243b3cee7b23b03f06ba0276809842",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 177,
"avg_line_length": 65.82113821138212,
"alnum_prop": 0.7565464426877471,
"repo_name": "braintree/braintree_python",
"id": "85fa191eff7d4e8b5ecae935f4fa99f3aba52865",
"... |
"""
Sense-T data platform v2 API client library
"""
from __future__ import absolute_import, unicode_literals, print_function
from .api import API
__version__ = '2.0.4'
__author__ = 'Ionata Digital'
__license__ = 'MIT'
api = API()
| {
"content_hash": "519415fbc038fc02a16ff9b11b68bf23",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 72,
"avg_line_length": 21.09090909090909,
"alnum_prop": 0.6681034482758621,
"repo_name": "ionata/senset-data-portal",
"id": "e27dd17444e898b003c5e8f57dad12d9eedc68ed",
"siz... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('shopifier_admin', '0011_user_permissions'),
]
operations = [
migrations.AddField(
model_name='userlog',
name='user_agent',
... | {
"content_hash": "6a5f979e8a92106502c17ded78d59b55",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 63,
"avg_line_length": 22.22222222222222,
"alnum_prop": 0.6025,
"repo_name": "HiDevLab/shopifier",
"id": "d642fccd9fa03d8d54b254ff009be779a05e8f08",
"size": "472",
"binar... |
import importlib
import os.path
import pkgutil
import sys
import time
import types
import warnings
from collections import deque, Hashable
__all__ = ['crawl_pythonpath', 'scrape_docstrings']
def crawl_pythonpath(verbose=False):
"""Returns a list of all accessible modules, as module objects.
Includes builtin modu... | {
"content_hash": "645f779cbb5207883b75c9ea19d6b0d7",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 78,
"avg_line_length": 30.10810810810811,
"alnum_prop": 0.6361460203470976,
"repo_name": "perimosocordiae/modsearch",
"id": "36382eff715d3eea95f547fe0dff05dcfe03bc49",
"si... |
import datetime
import hashlib
import json
import sys
from oslo_config import cfg
from oslo_log import log as logging
import sqlalchemy as sa
from sqlalchemy import event
from sqlalchemy.orm import backref
from sqlalchemy.orm import relationship
from mistral.db.sqlalchemy import model_base as mb
from mistral.db.sqlal... | {
"content_hash": "bce9086b5dd4ff993ab6606f7370fe32",
"timestamp": "",
"source": "github",
"line_count": 713,
"max_line_length": 79,
"avg_line_length": 31.13884992987377,
"alnum_prop": 0.63728492928565,
"repo_name": "openstack/mistral",
"id": "2d24045d14301c3bd34fbfa358470991a8c7ea52",
"size": "2287... |
import os
import re
import subprocess
import unittest
import sys
import selenium_utilities
import selenium_constants
class PDiffTest(unittest.TestCase):
"""A perceptual diff test class, for running perceptual diffs on any
number of screenshots."""
def __init__(self, name, num_screenshots, screenshot_name, pd... | {
"content_hash": "e58b340c5e296f6159d442d1b1c8389e",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 79,
"avg_line_length": 39.10606060606061,
"alnum_prop": 0.6030608291359938,
"repo_name": "rwatson/chromium-capsicum",
"id": "0a91f55c90eefd7b11345823512ed3e1e9ed7642",
"si... |
from hadoop.io import SequenceFile, Text
from hadoop.io.SequenceFile import CompressionType
import msgpack
import re
import itertools
writer = SequenceFile.createWriter ('pg10.seq', Text, Text, compression_type=CompressionType.BLOCK)
key = Text()
value = Text()
with open ('pg10.txt', 'r') as f:
for pos, line in... | {
"content_hash": "2adf93106a0f200ab2247051be015773",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 99,
"avg_line_length": 23.444444444444443,
"alnum_prop": 0.6382306477093207,
"repo_name": "kmatzen/HadoopPythonMR",
"id": "c5df39758152129cbc19407bfd28c28e379c3f76",
"size"... |
import pprint
import requests
import sklearn
from sklearn import tree
# Attribute Information of the Pima Indians Diabetes Data Set:
# Ref: http://archive.ics.uci.edu/ml/datasets/Pima+Indians+Diabetes
# 1. Number of times pregnant
# 2. Plasma glucose concentration a 2 hours in an oral glucose tolerance test
# 3. Dia... | {
"content_hash": "c7922df0a0f792825baa060ba63dc3e6",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 131,
"avg_line_length": 27.57777777777778,
"alnum_prop": 0.7316680096696213,
"repo_name": "creativcoder/AlgorithmicProblems",
"id": "9884b0f30196d75110a4d7d420c8aac9aa701b8d"... |
import requests
from ricecooker.config import LOGGER
# DEFAULT_STUDIO_URL = 'https://develop.studio.learningequality.org'
# DEFAULT_STUDIO_URL = 'http://127.0.0.1:8080'
DEFAULT_STUDIO_URL = "https://studio.learningequality.org"
# TODO https://studio.learningequality.org/api/get_node_path/ca8f380/18932/41b2549
# TO... | {
"content_hash": "1c8a0984d0accef91ecab1b63d417d9d",
"timestamp": "",
"source": "github",
"line_count": 219,
"max_line_length": 98,
"avg_line_length": 41.44292237442922,
"alnum_prop": 0.6066549140590568,
"repo_name": "learningequality/ricecooker",
"id": "fd5c77876461caefed0196bbd3580aca2275c201",
"... |
from django.shortcuts import render, redirect
from django.core.exceptions import ObjectDoesNotExist, PermissionDenied
from django.contrib.auth.decorators import login_required, permission_required
from django.views.decorators.http import require_http_methods
from django.contrib import messages
from tracker.models impo... | {
"content_hash": "4de742c82416dadf704e0e817df564ab",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 78,
"avg_line_length": 29.348837209302324,
"alnum_prop": 0.6735340729001584,
"repo_name": "KenN7/LifeTracker",
"id": "0e19975087d0e00f404aac3bdb739e9919d2cd51",
"size": "12... |
import gevent
import gevent.queue
import gevent.wsgi
import os
import sys
import logging
import pdb
import json
from pprint import pprint
import functools
import socket
import time
import errno
import re
import copy
from lxml import etree
try:
from collections import OrderedDict
except ImportError:
from ordered... | {
"content_hash": "df23d968bbe8d3dd4271c5881c377577",
"timestamp": "",
"source": "github",
"line_count": 894,
"max_line_length": 106,
"avg_line_length": 32.9407158836689,
"alnum_prop": 0.5355020543991307,
"repo_name": "Juniper/contrail-dev-controller",
"id": "f917509d83de343c2974acdb5366e31bcf688c61",... |
"""Utility methods for package db."""
import yaml
def yaml_load(path):
with open(path, 'r', encoding='utf-8') as f:
# data_yaml = yaml.load(f, Loader=yaml.FullLoader)
data_yaml = yaml.load(f, Loader=yaml.FullLoader)
return data_yaml
| {
"content_hash": "189898aa5d2a0ac763615435bbcd5d50",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 58,
"avg_line_length": 26,
"alnum_prop": 0.6423076923076924,
"repo_name": "verejnedigital/verejne.digital",
"id": "41ce334cfeb5d3ccf20f267f1effb96a5a3c361c",
"size": "260",... |
"""Core module. Provides the basic operations needed in sympy.
"""
from sympify import sympify
from cache import cacheit
from basic import Basic, Atom, C, preorder_traversal
from singleton import S
from expr import Expr, AtomicExpr
from symbol import Symbol, Wild, Dummy, symbols, var
from numbers import Number, Float,... | {
"content_hash": "95d6a0ac1511173d6583a2696bccc12d",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 77,
"avg_line_length": 38.470588235294116,
"alnum_prop": 0.7622324159021406,
"repo_name": "srjoglekar246/sympy",
"id": "8b5d3c4f060d8974f698b843a4e51c3f2c7cb5b3",
"size": "... |
from server.modules import (accounts, groups)
import pickle
import time
"""
Manages and stores messages between users and in groups.
"""
class MessageManager:
def __init__(self):
self.callbacks = {}
try:
with open('messages.pickle', 'rb') as f:
self.messages = pickle.lo... | {
"content_hash": "1e1c9121b4d0f5ba14fa96bc8fd4de16",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 139,
"avg_line_length": 29.542056074766354,
"alnum_prop": 0.5631129389433723,
"repo_name": "cs460-group1/chat-server",
"id": "9bfe4feaf04f0a314213a4899a330e4751d94200",
"s... |
from setuptools import setup, find_packages
readme = open('README.rst').read()
def get_version():
try:
import subprocess
p = subprocess.Popen('hg id -t', shell=True, stdout=subprocess.PIPE)
tag = p.stdout.read()[1:].strip()
return tag
except:
return 'dev'
setup(
na... | {
"content_hash": "abb144db2ebdc06eb89c3bd6e7c42016",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 76,
"avg_line_length": 21.896551724137932,
"alnum_prop": 0.6125984251968504,
"repo_name": "haltu/eca-eops",
"id": "9e2eb97c65e734bf41518f4035f342760932f18e",
"size": "682",... |
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
DOCUMENTATION = '''
---
module: opendj_backendprop
short_description: Will update the backend configuration of OpenDJ via the dsconfig set-backend-prop command.
description:
- This modul... | {
"content_hash": "60b1a024efbb9210de6adf4b914f353e",
"timestamp": "",
"source": "github",
"line_count": 200,
"max_line_length": 111,
"avg_line_length": 34.605,
"alnum_prop": 0.5597457014882242,
"repo_name": "nwiizo/workspace_2017",
"id": "893bbfdd47d243379eab8996c624fa16550e2e22",
"size": "7676",
... |
import os
import pickle
import evolve_interactive as evolve
import neat
evolve.W = 1000
evolve.H = 1000
with open("genome-4432-586.bin", "rb") as f:
g = pickle.load(f)
print(g)
node_names = {0: 'x', 1: 'y', 2: 'gray'}
# visualize.draw_net(g, view=True, filename="picture-net.gv",
# ... | {
"content_hash": "e60fbdfbab3b0e9db0fb28481da79c36",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 94,
"avg_line_length": 39.02564102564103,
"alnum_prop": 0.5992115637319316,
"repo_name": "CodeReclaimers/neat-python",
"id": "8c77f1f224db15d788b722406f08c7c9e4dd4558",
"si... |
import re
import sys
import os
from pathlib import Path
from docutils import nodes
from docutils.statemachine import ViewList
from docutils.transforms import Transform
from docutils.parsers.rst import Directive, directives
from sphinx import addnodes
from sphinx.util.nodes import set_source_info, process_index_entry
s... | {
"content_hash": "5de021759eb1f5b0f303fe5abc1d6b49",
"timestamp": "",
"source": "github",
"line_count": 279,
"max_line_length": 79,
"avg_line_length": 32.98566308243728,
"alnum_prop": 0.6349016625013583,
"repo_name": "sysint64/emacs-config",
"id": "358a8ec759ef019f8c978891964bda5074f0b41b",
"size":... |
from __future__ import absolute_import
from django.contrib import messages
from django.utils.translation import ugettext_lazy as _
from sentry.plugins import plugins
from sentry.web.frontend.base import ProjectView
class ProjectPluginsView(ProjectView):
required_scope = 'project:write'
def handle(self, req... | {
"content_hash": "c4dda1a3df61c9bbcaba0e016f74843d",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 86,
"avg_line_length": 32.76923076923077,
"alnum_prop": 0.6431924882629108,
"repo_name": "looker/sentry",
"id": "0eb33ddea61c54134142ad35a6f96e86f4279b3a",
"size": "852",
... |
from django.urls import path
from . import views
urlpatterns = [
# Homepage
path("", views.homepage, name="pontoon.homepage"),
]
| {
"content_hash": "9239694729d73526e1c4f430403205ca",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 54,
"avg_line_length": 17.375,
"alnum_prop": 0.6762589928057554,
"repo_name": "jotes/pontoon",
"id": "2d8ca036aed26c378b769645a8c1d93734cdf1fd",
"size": "139",
"binary": f... |
from __future__ import print_function
import unittest
from six.moves import xrange
import pydocumentdb.document_client as document_client
import pydocumentdb.documents as documents
import test.test_config as test_config
from pydocumentdb.errors import HTTPFailure
class _config:
host = test_config._test_config.... | {
"content_hash": "46d0800ab1e421d4d7093facc4d732e2",
"timestamp": "",
"source": "github",
"line_count": 251,
"max_line_length": 119,
"avg_line_length": 40.62948207171315,
"alnum_prop": 0.5118650715826633,
"repo_name": "rnagpal/azure-documentdb-python",
"id": "c7c033eaeaf00de11e32d64ce248b54c3909347e"... |
from .render import CodePygmentsRenderer # noqa
| {
"content_hash": "d61fb09c3cc9038ccb90b27f3ee25345",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 48,
"avg_line_length": 49,
"alnum_prop": 0.8163265306122449,
"repo_name": "AddisonSchiller/modular-file-renderer",
"id": "5a0dd791973766b3acf33aac3afeb8a0a1b99977",
"size": ... |
import os
import shutil
import sys
xwalk_dir = os.path.dirname(os.path.abspath(__file__))
def CopyToPathWithName(root, name, final_path, rename):
if name == '':
return False
origin_path = os.path.join(root, name)
if not os.path.exists(origin_path):
print('Error: \'' + origin_path + '\' not found.')
... | {
"content_hash": "33d21beaa9f32d3254fcd836cfdf811e",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 77,
"avg_line_length": 35.63253012048193,
"alnum_prop": 0.6417582417582418,
"repo_name": "huningxin/crosswalk",
"id": "719d02fe4495fa915475f9af7d01c7ba5aa4dd29",
"size": "... |
import time
import datetime
class FeedTime(object):
'''
The
Attributes:
hour_of_the_day: hour to be fed in 24 hour clock
minute_of_the_day: minute of the hour to be fed
'''
def __init__(self, hour_of_the_day, minute_of_the_day):
self.hour_of_the_day = hour_of_the_day
self.minute_of_the... | {
"content_hash": "1b3db9df20965d337bf31e479549af4c",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 112,
"avg_line_length": 31.76086956521739,
"alnum_prop": 0.6577686516084873,
"repo_name": "rob-murray/cat-bot",
"id": "51bace7c14b846082c964b41fdd6eca0b6c79cf8",
"size": "1... |
import base64
from writers import adml_writer
from writers.admx_writer import AdmxElementType
def GetWriter(config):
'''Factory method for creating ADMLWriter objects for the Chrome OS platform.
See the constructor of TemplateWriter for description of arguments.
'''
return ChromeOSADMLWriter(['chrome_os'], c... | {
"content_hash": "62aab1046582fa60c54118d1a6a0c044",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 79,
"avg_line_length": 33.535714285714285,
"alnum_prop": 0.7657082002129926,
"repo_name": "chromium/chromium",
"id": "24b30e8e8833a615b65062afb950733f9b882c54",
"size": "11... |
"""
Tests of neo.io.blackrockio
"""
# needed for python 3 compatibility
from __future__ import absolute_import
import os
import sys
import re
import warnings
try:
import unittest2 as unittest
except ImportError:
import unittest
import numpy as np
import quantities as pq
from neo import NeuralynxIO, AnalogS... | {
"content_hash": "7d3a1f50caa396f6642b2b5e1838db45",
"timestamp": "",
"source": "github",
"line_count": 455,
"max_line_length": 79,
"avg_line_length": 39.2,
"alnum_prop": 0.5830343126261494,
"repo_name": "CINPLA/python-neo",
"id": "ecc54430b013c9f69a8f72c49043f48cacdff239",
"size": "17860",
"bina... |
import datetime
from psoc_4m_base_network import *
class PSOC_4M_MOISTURE_UNIT(PSOC_BASE_4M):
def __init__(self,instrument):
self.system_id = 0x201
PSOC_BASE_4M.__init__( self, instrument, self.system_id)
# additional write address definitions definitions
self.check_one_wir... | {
"content_hash": "7fd9ae2be0370541c121a52edaccdfd8",
"timestamp": "",
"source": "github",
"line_count": 220,
"max_line_length": 138,
"avg_line_length": 34.85,
"alnum_prop": 0.5620190426503195,
"repo_name": "glenn-edgar/local_controller_3",
"id": "a4aea303404910b4c00c09233ae8c2af36e5cafc",
"size": "... |
import sys
import tkinter as tk
import tkplot
import threading
from queue import Queue, Empty
import serial
import struct
from collections import namedtuple
import time
import csv
import math
def execute_delayed(root, generator):
"""For each yielded value wait the given amount of time (in seconds)
without paus... | {
"content_hash": "1c623990f05ed2f63d220381f3b64cbc",
"timestamp": "",
"source": "github",
"line_count": 230,
"max_line_length": 116,
"avg_line_length": 32.334782608695654,
"alnum_prop": 0.5600376495898884,
"repo_name": "Miceuz/ScaleHack",
"id": "1482a620e189d6da0b23ac05c42a99e15c432560",
"size": "7... |
import tkinter as tk
def callback(ev):
print(ev.x, ev.y)
root = tk.Tk()
frame = tk.Frame(root, width=320, height=240)
frame.bind('<Motion>', callback)
frame.pack()
root.mainloop()
| {
"content_hash": "ac1c16a93693c2a04f22217747dc74e8",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 45,
"avg_line_length": 14.538461538461538,
"alnum_prop": 0.6666666666666666,
"repo_name": "Yuvv/LearnTestDemoTempMini",
"id": "099028d6546f75234aa2aa1719d2e77ec90b9efd",
"s... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Post'
db.create_table('blog_post', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=Tru... | {
"content_hash": "bee486ef226fa7466d6665cdd4cd4d9a",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 138,
"avg_line_length": 50.18604651162791,
"alnum_prop": 0.5885078776645042,
"repo_name": "fatiherikli/dbpatterns",
"id": "18e5694f9f8aa424c909bf2a75b29e11396cd90c",
"size"... |
import optimus.project_specific
| {
"content_hash": "c799b6554b18fcbbda1caf7f7618b74a",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 31,
"avg_line_length": 32,
"alnum_prop": 0.875,
"repo_name": "PFWhite/optimus",
"id": "781e2472c21d470b1cf28a15b1f177be223bee1b",
"size": "32",
"binary": false,
"copies"... |
import datetime
import logging
import os
import random
import sys
import unittest
import mock
import test_env_handlers
import webapp2
import webtest
from google.appengine.api import app_identity
from google.appengine.api import memcache
from google.appengine.ext import ndb
from google.protobuf import struct_pb2
fr... | {
"content_hash": "1b1c956413be37e2c6f4a50071bdf747",
"timestamp": "",
"source": "github",
"line_count": 724,
"max_line_length": 80,
"avg_line_length": 37.38259668508287,
"alnum_prop": 0.6094956585996675,
"repo_name": "luci/luci-py",
"id": "c450636a3262325331a4fd43249c578b9cefd299",
"size": "27262",... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('marketing', '0009_vehicle_ad_type'),
]
operations = [
migrations.AddField(
model_name='lead',
name='flight',
fie... | {
"content_hash": "c9c3225b2188d9632ce5b3c079fd370a",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 85,
"avg_line_length": 22.666666666666668,
"alnum_prop": 0.6004901960784313,
"repo_name": "edilio/dental",
"id": "c8be52b9caab476b12c4a75129d9f54ca9d75022",
"size": "432",
... |
"""The tests for the REST binary sensor platform."""
import asyncio
from os import path
from unittest.mock import patch
import httpx
import respx
from homeassistant import config as hass_config
import homeassistant.components.binary_sensor as binary_sensor
from homeassistant.const import (
ATTR_ENTITY_ID,
CO... | {
"content_hash": "9208234a603deaa2f2930a430bb6a1a6",
"timestamp": "",
"source": "github",
"line_count": 394,
"max_line_length": 83,
"avg_line_length": 28.573604060913706,
"alnum_prop": 0.5280689287617694,
"repo_name": "partofthething/home-assistant",
"id": "9adb04ea40c2e6e37c7bfe391f3878c7d0d7af91",
... |
"""Main test class for binreconfiguration""" | {
"content_hash": "cdb66125fb0826008417ccb45bfecd11",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 44,
"avg_line_length": 44,
"alnum_prop": 0.7727272727272727,
"repo_name": "vialette/binreconfiguration",
"id": "e74509d6b781fb64b06f3faaf3c1c5a6f22c0167",
"size": "44",
"b... |
from __future__ import division
from bisect import bisect_left, bisect_right
import statistics
from .utils import cached_property
class Stats(object):
fields = (
"min", "max", "mean", "stddev", "rounds", "median", "iqr", "q1", "q3", "iqr_outliers", "stddev_outliers",
"outliers", "ld15iqr", "hd15... | {
"content_hash": "727549f30062df87ec0a04c6e66d968b",
"timestamp": "",
"source": "github",
"line_count": 159,
"max_line_length": 113,
"avg_line_length": 26.08176100628931,
"alnum_prop": 0.5196527610320714,
"repo_name": "aldanor/pytest-benchmark",
"id": "de242a5604c79bb755202fe974451675ae1b7abd",
"si... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from fancypages.utils import FP_NODE_MODEL
from fancypages.compat import AUTH_USER_MODEL, AUTH_USER_MODEL_NAME
class Migration(SchemaMigration):
def forwards(self, orm):
db.create_table(u'fancypages... | {
"content_hash": "ea21c2724da18a7078928bd69aafdd19",
"timestamp": "",
"source": "github",
"line_count": 319,
"max_line_length": 125,
"avg_line_length": 71.86520376175548,
"alnum_prop": 0.5163794983642311,
"repo_name": "socradev/django-fancypages",
"id": "fd4c4a5c1f28aa13562290a877066b47bdf15421",
"... |
class NoSkypeConversationException(Exception):
pass
class NoSkypeFriendException(Exception):
pass | {
"content_hash": "31134bd40b515f5678d060d9edca4e44",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 46,
"avg_line_length": 21.2,
"alnum_prop": 0.8113207547169812,
"repo_name": "nickpack/Igor",
"id": "262f2bce8dd4bddd4ecd60a5021bba4e85f035ea",
"size": "107",
"binary": fal... |
"""Implements a servo in MPF."""
import asyncio
from typing import Optional
from mpf.platforms.interfaces.stepper_platform_interface import StepperPlatformInterface
from mpf.core.delays import DelayManager
from mpf.core.device_monitor import DeviceMonitor
from mpf.core.events import event_handler
from mpf.core.syst... | {
"content_hash": "2841cebcdd0cd7a1c29a0f8f40ac8b4d",
"timestamp": "",
"source": "github",
"line_count": 221,
"max_line_length": 120,
"avg_line_length": 41.89592760180995,
"alnum_prop": 0.6004968139107895,
"repo_name": "missionpinball/mpf",
"id": "9352f2ebbf047a0eadd24135afa70a49baaff779",
"size": "... |
from sys import argv
script,filename = argv
print "We're going to erase %r." % filename
print "If you don't want that, hit CTRL-C(^C)."
print "If you do want that, hit RETURN."
raw_input("?")
print "Opening the file..."
target = open(filename, 'w')
print "Truncating the file. Goodbye!"
target.truncate(... | {
"content_hash": "e5085e8fe2902b81fc2b4e5b63b83a14",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 49,
"avg_line_length": 21.96875,
"alnum_prop": 0.6543385490753911,
"repo_name": "Jumpers/MysoftAutoTest",
"id": "3f0275a6249795fad79e5f9f29ed2e32f02f7505",
"size": "726",
... |
"""
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 use this ... | {
"content_hash": "0092c6c8b5e05f6644cf1d9afda35266",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 129,
"avg_line_length": 35.6025641025641,
"alnum_prop": 0.7385667987036371,
"repo_name": "radicalbit/ambari",
"id": "80ea0f5bee03cfd99ef1fe5cc6ac975162e78037",
"size": "279... |
import logging
import os
import types
import weakref
from collections import defaultdict
import archinfo
import cle
from cle.address_translator import AT
l = logging.getLogger("angr.project")
# This holds the default execution engine for a given CLE loader backend.
# All the builtins right now use SimEngineVEX. Thi... | {
"content_hash": "d0f6113356a8a65244ac5f9e8cbf1c54",
"timestamp": "",
"source": "github",
"line_count": 544,
"max_line_length": 152,
"avg_line_length": 43.41360294117647,
"alnum_prop": 0.6130753270948893,
"repo_name": "Ruide/angr-dev",
"id": "b411f1a7c258a46a12975dc4545a4962de602b8d",
"size": "2361... |
import argparse
import errno
import hashlib
import os
import shutil
import subprocess
import sys
import tempfile
from io import StringIO
from lib.config import PLATFORM, get_target_arch, get_chromedriver_version, \
get_env_var, s3_config, get_zip_name
from lib.util import electron_gyp, execute, ... | {
"content_hash": "3946a13276d28f7b63800f3f0faf9d33",
"timestamp": "",
"source": "github",
"line_count": 263,
"max_line_length": 79,
"avg_line_length": 32.90874524714829,
"alnum_prop": 0.6577700751010976,
"repo_name": "posix4e/electron",
"id": "00b44c2429e82ad302fd55dcc7caa27e92f8db85",
"size": "867... |
from ....datasources.meta import dicts, filters
from ....dependencies import DependentSet
from ....features.meta import aggregators
class Revision(DependentSet):
def __init__(self, name, revision_datasources):
super().__init__(name)
self.datasources = revision_datasources
self.dict_words... | {
"content_hash": "79b07a2020b540935662540b509624cf",
"timestamp": "",
"source": "github",
"line_count": 158,
"max_line_length": 79,
"avg_line_length": 38.91139240506329,
"alnum_prop": 0.5936890045543266,
"repo_name": "yafeunteun/wikipedia-spam-classifier",
"id": "f12f37b3aef8af4eda127fb5254af544c5f5c... |
from typing import Any, Optional
import pandas as pd
from pandas_profiling.report.presentation.core.item_renderer import ItemRenderer
class Sample(ItemRenderer):
def __init__(
self, name: str, sample: pd.DataFrame, caption: Optional[str] = None, **kwargs
):
super().__init__(
"sam... | {
"content_hash": "aa5cb05ad242bd28605dde410249dd14",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 86,
"avg_line_length": 25.9,
"alnum_prop": 0.6196911196911197,
"repo_name": "JosPolfliet/pandas-profiling",
"id": "597c7d24801a5ef2121c9b2327542be9e7d3cc3a",
"size": "518",... |
import copy
from oslo.config import cfg
cfg.CONF.import_opt('max_resources_per_stack', 'heat.common.config')
from heat.common import exception
from heat.common import template_format
from heat.common import urlfetch
from heat.db import api as db_api
from heat.engine import parser
from heat.engine import resource
fro... | {
"content_hash": "1809d2ffe19198d4cea11d94d99f3d4c",
"timestamp": "",
"source": "github",
"line_count": 487,
"max_line_length": 77,
"avg_line_length": 32.0041067761807,
"alnum_prop": 0.619273707173104,
"repo_name": "JioCloud/heat",
"id": "b81f30d93bea5213eec538c106e122bb8435a9b0",
"size": "16205",
... |
from exceptions import NotImplementedError, ValueError
from numpy import add, multiply, divide
from numpy.linalg import norm
from AbstractFunction import AbstractFunction
class AbstractFeasibleDirectionsDescender:
"""
Abstract class for feasible direction descend optimization method.
"""
def __init__(self, ... | {
"content_hash": "7757a1334bd6d230b956bf108e198f81",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 79,
"avg_line_length": 30.11764705882353,
"alnum_prop": 0.653515625,
"repo_name": "char-lie/feasible_directions",
"id": "07223b5f0d45bb603d6411ff17caa7591929a2b9",
"size": ... |
import sys
import os
from win32com.shell import shellcon, shell
# Should be programdata files folder
ROOT_FOLDER = os.path.join(
shell.SHGetFolderPath(0, shellcon.CSIDL_COMMON_APPDATA, None, 0), "ope")
TMP_FOLDER = os.path.join(ROOT_FOLDER, "tmp")
LOG_FOLDER = os.path.join(TMP_FOLDER, "log")
SCREEN_SHOTS_FOLD... | {
"content_hash": "748d79210d89213dd83d1f483c27ce26",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 105,
"avg_line_length": 31.5188679245283,
"alnum_prop": 0.6114935648009578,
"repo_name": "operepo/ope",
"id": "4502d89c240d4e410ad0c98985f0d8e184fe62b4",
"size": "3341",
... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('profiles', '0007_auto_20180624_1435'),
]
operations = [
migrations.AddField(
model_name='user',
name='reviewer',
field=models.EmailField(blank=True, max_... | {
"content_hash": "4e02d5bc817410376dd08fc9ddfb7f21",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 75,
"avg_line_length": 22.5625,
"alnum_prop": 0.5817174515235457,
"repo_name": "pytexas/PyTexasBackend",
"id": "f221016099dc6fa7dea6f3dcd6359e75e47ba0a0",
"size": "411",
... |
from redis_store import redis_db
import tornadoredis
redis_pub = tornadoredis.Client()
redis_pub.connect()
class GameChannel(object):
@classmethod
def gen_key(cls):
counter = redis_db.incr('channel:count', 1)
counter = int(counter) + 1
channel_key = 'channel:' + str(counter)
... | {
"content_hash": "b9ab5aee87f1854ac212feccd6b53632",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 62,
"avg_line_length": 29.613636363636363,
"alnum_prop": 0.6362240982348427,
"repo_name": "sampathweb/game-server",
"id": "007340b78681d8ab9522701c43a432deff8d3a8b",
"size"... |
from .kao_module import KaoModule
from .namespaced_class import NamespacedClass | {
"content_hash": "8698c09a7f5b93fcc2cd7d63372708f3",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 45,
"avg_line_length": 40,
"alnum_prop": 0.85,
"repo_name": "cloew/KaoModules",
"id": "cfbdce08076682a518696e4af189caa172ab5c44",
"size": "80",
"binary": false,
"copies"... |
from __future__ import print_function
import sys
import os
from getopt import getopt
try:
import czipfile as zipfile
except ImportError:
import zipfile
import reststore
from reststore import config
def command_web():
from reststore import webapp
webapp.run()
return 0
def command_get(FilesClass, ... | {
"content_hash": "72b4b1e0436c785cd54244c5b0c73419",
"timestamp": "",
"source": "github",
"line_count": 315,
"max_line_length": 80,
"avg_line_length": 31.12063492063492,
"alnum_prop": 0.5459553198000612,
"repo_name": "provoke-vagueness/reststore",
"id": "e8e242392d10e9d6126e26b1ea80aa9ee510e987",
"... |
from __future__ import print_function, unicode_literals, division
import pygame, pygame.gfxdraw, padlib, copy, programs, demomap as Map, player as Player, misc, config
from pygame.locals import *
class main(object):
def __init__(self):
pygame.init()
pygame.display.gl_set_attribute(GL_MULTISAMPLEBUF... | {
"content_hash": "e972b71ccdc3df423cb5584bb93c6bdc",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 111,
"avg_line_length": 44.875,
"alnum_prop": 0.6050139275766017,
"repo_name": "smartboyathome/Haxxit-Old",
"id": "344a94a3d119eff45c92b24bcd00cd28e05f6809",
"size": "1814"... |
COMMAND_STATEMENT = """
"""
TEMPLATE = """
{{ Paste to Kontakt Script Editor }}
on init
{{ primitive variables }}
declare $i
declare %ia[ 2 ]
declare ~r
declare ?ra[ 2 ]
declare @s
declare !sa[ 2 ]
{{ ui variable }}
declare ui_button $button
declare ui_knob $knob( 0, 1000, 1 )
declare ui_file_selector $selector
... | {
"content_hash": "58e202c564c39e6549494214ea45e48a",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 68,
"avg_line_length": 11.654545454545454,
"alnum_prop": 0.7082683307332294,
"repo_name": "r-koubou/KSPSyntaxParser",
"id": "39e77059445ddc4e3d57fb896c145b51c6bda3e9",
"si... |
from __future__ import print_function
import time
import numpy as np
import matplotlib.pyplot as plt
from cs231n.classifiers.fc_net import *
from cs231n.data_utils import get_CIFAR10_data
from cs231n.gradient_check import eval_numerical_gradient, eval_numerical_gradient_array
from cs231n.solver import Solver
# get_ipy... | {
"content_hash": "77cc9a54939f7d1ed20f03cfc089e36e",
"timestamp": "",
"source": "github",
"line_count": 367,
"max_line_length": 471,
"avg_line_length": 37.247956403269754,
"alnum_prop": 0.6788588149231894,
"repo_name": "DavidQiuChao/CS231nHomeWorks",
"id": "a21802818e27bc06874afc790de4e71827b02e5f",
... |
from django import forms
from compactapp.models import Area
import xlrd
class SimpleAnalysis(forms.Form):
""""Provides the user with the Simple Analysis form."""
areas = Area.objects.values('name')
area_name = list(entry['name'] for entry in areas)
#Gets all the US States from the database and puts th... | {
"content_hash": "94b45418935165a2c7ecc72b312cca22",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 151,
"avg_line_length": 48.421052631578945,
"alnum_prop": 0.7134057971014492,
"repo_name": "justbreakingstuff/compact",
"id": "5e45424982c8be833e604f5f6bf0060a1fc14b2a",
"s... |
import itertools
import sys
import types
import warnings
import weakref
from collections import OrderedDict, defaultdict
from collections.abc import Mapping
from copy import deepcopy
import numpy as np
from numpy import ma
from astropy import log
from astropy.io.registry import UnifiedReadWriteMethod
from astropy.uni... | {
"content_hash": "d06bce745a2038fd37447a90fe1c1652",
"timestamp": "",
"source": "github",
"line_count": 4246,
"max_line_length": 96,
"avg_line_length": 36.0032972209138,
"alnum_prop": 0.5402106364885196,
"repo_name": "astropy/astropy",
"id": "5d39b7b01c2722548f0dbef524f8a02911807a8d",
"size": "1529... |
from ginga.cairow.ImageViewCanvasTypesCairo import *
#END
| {
"content_hash": "432794a2f57fe0d8dc420ebc61f85001",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 52,
"avg_line_length": 15,
"alnum_prop": 0.8166666666666667,
"repo_name": "Rbeaty88/ginga",
"id": "38a4963dea131d6ac0f801d438bbeb913e76aafb",
"size": "383",
"binary": fals... |
from django.test import TestCase
class QuestionViewTests(TestCase):
def test_revenue(self):
try:
from revenue.models import Revenue
except ImportError:
self.fail('No such revenue model')
| {
"content_hash": "7b4b6bcc41e2868877d26b68747107aa",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 46,
"avg_line_length": 29,
"alnum_prop": 0.6551724137931034,
"repo_name": "bahadir/packathon2016",
"id": "5a812b261b441db50ef53c4b3b8eadf8ed7129e6",
"size": "232",
"binary... |
"""
r4 - a wrapper around p4 adding new, custom functionality.
Prerequisites:
* P4 python bindings. I used the version at
ftp://ftp.perforce.com/perforce/r10.1/bin.tools/p4python.tgz
(The python bindings have their own installation instructions, but
basically you need to first install the Perforce C++ API.)
"""
fr... | {
"content_hash": "d535015359d384015cda3b2b14315a95",
"timestamp": "",
"source": "github",
"line_count": 625,
"max_line_length": 118,
"avg_line_length": 33.312,
"alnum_prop": 0.5743996157540826,
"repo_name": "wiseman/r4",
"id": "f02c829e92207485d6c0a170184a86c168fc1dc0",
"size": "20875",
"binary":... |
__author__ = "maggie.sun@intel.com, ryan.lei@intel.com"
import os
import xlsxwriter
import xlrd
import re
from Config import QPs, DnScaleRatio, QualityList, VbaBinFile, CvxH_WtRows,\
CvxH_WtLastCol, LoggerName, CalcBDRateInExcel, CvxH_WtCols, CvxHDataRows, CvxHDataStartCol
from Utils import GetShortContentName, Ca... | {
"content_hash": "fac4de1ea8f40d507429344c5b306896",
"timestamp": "",
"source": "github",
"line_count": 510,
"max_line_length": 122,
"avg_line_length": 48.59411764705882,
"alnum_prop": 0.5168462252350402,
"repo_name": "tdaede/awcy",
"id": "ad987c63e4ad59334cbc1863a2a3976528a8ef17",
"size": "25330",... |
"""
Mongodb-based Trials Object
===========================
Components involved:
- mongo
e.g. mongod ...
- driver
e.g. hyperopt-mongo-search mongo://address bandit_json bandit_algo_json
- worker
e.g. hyperopt-mongo-worker --loop mongo://address
Mongo
=====
Mongo (daemon process mongod) is used for IP... | {
"content_hash": "059f66c8a6ad7d3c41a4dc69846351ec",
"timestamp": "",
"source": "github",
"line_count": 1300,
"max_line_length": 136,
"avg_line_length": 36.44692307692308,
"alnum_prop": 0.5511280893185032,
"repo_name": "jaberg/hyperopt",
"id": "9dbf9542d1f0024f9cd2b6285081d8de8f16ca58",
"size": "47... |
import pytest
from apostello.mail import ApostelloEmailBackend
from site_config.models import SiteConfiguration
@pytest.mark.django_db
def test_apostello_mail_backend():
"""Test email backend pulling from settings and db."""
# test migration pulled env var
mail_backend = ApostelloEmailBackend()
asser... | {
"content_hash": "fb4f80f850c8596f0a24afa494f5a10e",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 58,
"avg_line_length": 32,
"alnum_prop": 0.7286184210526315,
"repo_name": "monty5811/apostello",
"id": "4e42e1f226d24f736a846102bcba52650eb9d6b4",
"size": "608",
"binary"... |
from datetime import datetime, timezone
from time import mktime
import parsedatetime
from recurrent.event_parser import RecurringEvent
from dateutil import rrule
class InvalidDatetimeException(Exception):
pass
class InvalidRecurringDateException(Exception):
pass
def strftime(timestamp_string, strftime_for... | {
"content_hash": "c28032dd55c63d032750c962c58b836d",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 80,
"avg_line_length": 34.65625,
"alnum_prop": 0.6366095581605049,
"repo_name": "GoogleCloudPlatform/professional-services",
"id": "224b051ef63621f8813446585a05f3dce323085a",... |
from __future__ import print_function, division, absolute_import
"""
When a Sympy expressions needs to be evaluated it is,
for performance reasons, preferable that the
numerics are performed in a compiled language
the codeexport module provide classes enabling
templates to be used as blueprints for generating, compili... | {
"content_hash": "8dd96183fa177bc48f7ab06a41c243a2",
"timestamp": "",
"source": "github",
"line_count": 532,
"max_line_length": 76,
"avg_line_length": 32.31954887218045,
"alnum_prop": 0.5810166337094336,
"repo_name": "bjodah/pycodeexport",
"id": "2b0cfdddbdea269cedb8708b0bab58d19c1761c7",
"size": "... |
from godot import exposed, rpcsync
from godot.bindings import Area2D, Vector2
DEFAULT_SPEED = 80
@exposed
class Ball(Area2D):
@rpcsync
def _reset_ball(self, for_left):
print('RESET BALL', for_left)
self.position = self.screen_size / 2
if for_left:
self.direction = Vector... | {
"content_hash": "02dd1b16e7114972da1827b3bffaaa20",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 95,
"avg_line_length": 39.13235294117647,
"alnum_prop": 0.5888763622698234,
"repo_name": "razvanc-r/godot-python",
"id": "d30d3a215902e727837c53ba96419e2a7864ef69",
"size":... |
import bisect
import logbook
import datetime
import pandas as pd
import numpy as np
from sqlalchemy import create_engine
from zipline.data.loader import load_market_data
from zipline.utils import tradingcalendar
from zipline.assets import AssetFinder
from zipline.assets.asset_writer import (
AssetDBWriterFromList... | {
"content_hash": "8260d50a7f29c1f3965b7e3b4de3df12",
"timestamp": "",
"source": "github",
"line_count": 516,
"max_line_length": 80,
"avg_line_length": 36.90503875968992,
"alnum_prop": 0.608465052775298,
"repo_name": "michaeljohnbennett/zipline",
"id": "35817162598c0e4b6535189496e057a374d71cd9",
"si... |
import pytest
import torch
import numpy
from allennlp.common.testing import AllenNlpTestCase
from allennlp.modules import GatedSum
class TestGatedSum(AllenNlpTestCase):
def test_gated_sum_can_run_forward(self):
a = torch.FloatTensor([1, 2, 3, 4, 5])
b = -a + 0.1
weight_value = 2
... | {
"content_hash": "31ae470c1ba8920e1f15be59d48b1244",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 97,
"avg_line_length": 32.32432432432432,
"alnum_prop": 0.6070234113712375,
"repo_name": "allenai/allennlp",
"id": "c1de01c1ec04f8847c262b76f6ec5aeaa4d301c9",
"size": "1196... |
from pymoku import InvalidOperationException
def stream_init(moku, uname, api_key, str_id1, str_id2, npoints=100, mode='lines', line={}):
line = ';'.join([ '='.join(i) for i in list(line.items())])
settings = [
('plotly.uname', uname),
('plotly.api_key', api_key),
('plotly.strid1', str_id1),
('plotly.strid... | {
"content_hash": "c7a264f95fdd1640a7bf7744b1508ab9",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 92,
"avg_line_length": 26.333333333333332,
"alnum_prop": 0.6818565400843882,
"repo_name": "benizl/pymoku",
"id": "f823c6094a403ab6a62faccb2e76b2e2b2d997a0",
"size": "1282",... |
from gcloud import storage
from oauth2client.service_account import ServiceAccountCredentials
import requests
from io import BytesIO
from PIL import Image
import os
from backend.api_keys import cloud_client_id, cloud_client_email, cloud_private_key_id, cloud_private_key, \
cloud_bucket_name
from backend.log_util im... | {
"content_hash": "65183f1df55188664b30179241ec4a4b",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 114,
"avg_line_length": 34.82666666666667,
"alnum_prop": 0.6573506891271057,
"repo_name": "l3d00m/pietsmiet_xposter",
"id": "988a9c9916fe960474a16c63729b8ae439b1f5e3",
"siz... |
import a
import b
import c
import d
import e
import f
# Colours
if platform.system() == 'Windows':
col_default = 0x07
col_red = 0x0C
col_green = 0x0A
else:
col_default = '\033[0m'
col_red = '\033[91m'
col_green = '\033[92m'
col_current = None
def set_text_colour(col):
global col_current
... | {
"content_hash": "8cccb2fbc62533237f08b5906e186df8",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 81,
"avg_line_length": 26.405405405405407,
"alnum_prop": 0.6202661207778914,
"repo_name": "github/codeql",
"id": "e6fa77a005f2af2a284f0870d64f50559706ed35",
"size": "977",
... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('trekking', '0037_auto_20220204_1533'),
]
operations = [
migrations.AlterField(
model_name='trek',
name='accessibility_infrastructure',
field=models.TextF... | {
"content_hash": "9fea169f7328592f762f0a467173e141",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 147,
"avg_line_length": 28.4375,
"alnum_prop": 0.6461538461538462,
"repo_name": "GeotrekCE/Geotrek-admin",
"id": "39018b470e672b03c9cecf4ae85d71662e7db9ab",
"size": "505",
... |
from src.utils.google_api import get_service
def _get_time_str(datetime_):
"""
日付を Google の Calendar API が扱う形式の文字列に変換する
:param datetime datetime_: 日時
"""
# マイクロ秒を削除
datetime_ = datetime_.replace(microsecond=0)
datetime_str = datetime_.isoformat()
if datetime_.tzinfo is None:
d... | {
"content_hash": "89e13b1fee767fa952a3a21c4b901145",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 135,
"avg_line_length": 27.458333333333332,
"alnum_prop": 0.6441578148710166,
"repo_name": "beproud/bp-cron",
"id": "aef9605fde4466bbf936f08297f2162d38eb029e",
"size": "162... |
import os
import operator
import sys
import contextlib
import itertools
import unittest
from distutils.errors import DistutilsError, DistutilsOptionError
from distutils import log
from unittest import TestLoader
from pkg_resources import (
resource_listdir,
resource_exists,
normalize_path,
working_set,... | {
"content_hash": "2c6ef65df65517c17e497d37cba1d209",
"timestamp": "",
"source": "github",
"line_count": 252,
"max_line_length": 79,
"avg_line_length": 32.095238095238095,
"alnum_prop": 0.5729475766567754,
"repo_name": "martbhell/wasthereannhlgamelastnight",
"id": "4a389e4d071d3753f14a8b74338def21f6b5... |
"""QR decomposition functions."""
from __future__ import division, print_function, absolute_import
import numpy
# Local imports
from .lapack import get_lapack_funcs
from .misc import _datacopied
__all__ = ['qr', 'qr_multiply', 'rq']
def safecall(f, name, *args, **kwargs):
"""Call a LAPACK routine, determining ... | {
"content_hash": "97ae402938aaffa1776d2e3ff62282ab",
"timestamp": "",
"source": "github",
"line_count": 424,
"max_line_length": 79,
"avg_line_length": 31.83254716981132,
"alnum_prop": 0.5345632362747277,
"repo_name": "lhilt/scipy",
"id": "32782f630032b17c1e1a3facf6bad4192b8ec9e8",
"size": "13497",
... |
import re, random, string, sys, math, os, datetime
BASE_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "../", "../")
sys.path.append(BASE_DIR)
import simplejson as json
import datetime
# ONE-TIME UPDATE OF post.created to draw from json['created_utc']
# rather than json['created']
ENV = os.environ[... | {
"content_hash": "ffdcc3587fb94d8c7d3687c921e1c6d4",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 199,
"avg_line_length": 44.54347826086956,
"alnum_prop": 0.7227916056612982,
"repo_name": "c4fcm/CivilServant",
"id": "f515535db3d2f5827d1fb6a6bdff9a31490fd277",
"size": "2... |
import json
import uuid
import mock
import netaddr
from quark.drivers import unmanaged
from quark import network_strategy
from quark.tests import test_base
class TestUnmanagedDriver(test_base.TestBase):
def setUp(self):
super(TestUnmanagedDriver, self).setUp()
self.strategy = {"public_network": ... | {
"content_hash": "0495e10360a47b8d62c01a7637cde395",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 79,
"avg_line_length": 41.46896551724138,
"alnum_prop": 0.5915516381174123,
"repo_name": "lmaycotte/quark",
"id": "e1b77273e9e7b33670ee8d20b39240f69c8cf8a4",
"size": "6622... |
from app import cache
from flask import Blueprint, jsonify, render_template, current_app
from app.models.example import ExampleModel
Example = Blueprint('exampleController', __name__, template_folder='templates', static_folder='static')
@Example.route('/')
def example_index():
return render_template('example/ex... | {
"content_hash": "788b99c7185dd2e33420925f71828f6b",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 103,
"avg_line_length": 23.677419354838708,
"alnum_prop": 0.7084468664850136,
"repo_name": "mobile2015/neoPyth",
"id": "eeef62545af6cfef58f4000ed7f214b1937f7ccc",
"size": "... |
class Singleton(object):
#
# Manage instance
#
# @var object
__Instance = None
#
# Name of the self
#
# @var string
__Name = 'Singleton'
#
# callback
#
def __new__(self,*args):
if (not self.__Instance):
self.__Instance = super(Singleton, self).__new__(self,*args)
else:
self.__init__ = self._... | {
"content_hash": "b0ebaaaa974d2b26a8812dcde18905ab",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 66,
"avg_line_length": 16.454545454545453,
"alnum_prop": 0.6187845303867403,
"repo_name": "dksr/REMIND",
"id": "7380070f72dbcc96a7874d2f22728cefa293e553",
"size": "2080",
... |
import IECore
import Gaffer
import GafferUI
class _BaseStatePlugValueWidget( GafferUI.PlugValueWidget ) :
def __init__( self, plug, **kw ) :
menu = GafferUI.Menu( Gaffer.WeakMethod( self.__menuDefinition ) )
menuButton = GafferUI.MenuButton( menu=menu, image = "drawingStyles.png", hasFrame=False )
Gaffer... | {
"content_hash": "a2f5da9d5f4e105756f6d0a148688d8a",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 114,
"avg_line_length": 22.68888888888889,
"alnum_prop": 0.66307541625857,
"repo_name": "paulondc/gaffer",
"id": "a0189a1a1c1fdcff61b0fa8b5c311accfd55b8c6",
"size": "2838",... |
from django.db import models
from django.contrib import admin
from django.db.models import signals
class Volunteer(models.Model):
first_name = models.CharField(max_length=50)
last_name = models.CharField(max_length=50)
email = models.EmailField(max_length=254, unique=True)
is_group = models.BooleanFie... | {
"content_hash": "86e0890f8cefdbb2ce78c1c78b75570a",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 114,
"avg_line_length": 37.5,
"alnum_prop": 0.670354609929078,
"repo_name": "jantaylor/road-home-time-tracker",
"id": "a964077a42f0f560150fb336e6aff7b882f16c97",
"size": "3... |
"""Generate ast module from specification
This script generates the ast module from a simple specification,
which makes it easy to accomodate changes in the grammar. This
approach would be quite reasonable if the grammar changed often.
Instead, it is rather complex to generate the appropriate code. And
the Node inte... | {
"content_hash": "59ea2d2f38e8e3e9a955ad469bd08f9b",
"timestamp": "",
"source": "github",
"line_count": 260,
"max_line_length": 122,
"avg_line_length": 31.234615384615385,
"alnum_prop": 0.5084349218076591,
"repo_name": "spaceone/pyjs",
"id": "a3fdb324131093e0cc6d0d62caf7e29fbaaf7471",
"size": "8121... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.