text stringlengths 4 1.02M | meta dict |
|---|---|
"""
twtxt.cache
~~~~~~~~~~~
This module implements a caching system for storing tweets.
:copyright: (c) 2016-2022 by buckket.
:license: MIT, see LICENSE for more details.
"""
import logging
import os
import shelve
from time import time as timestamp
from click import get_app_dir
logger = logging... | {
"content_hash": "b8f1656f9ffe4272569ddeaca7b68cb9",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 86,
"avg_line_length": 28.733333333333334,
"alnum_prop": 0.5638051044083526,
"repo_name": "buckket/twtxt",
"id": "4c90d0039a26416e435fda49a7fd584ffbff2c02",
"size": "3879"... |
from django.core.management.base import BaseCommand
from ...utils.lgUtils import *
from ...utils.earthquakesUtils import *
import requests
import json
from datetime import timedelta
import simplekml
from polycircles import polycircles
import datetime
from json.decoder import JSONDecodeError
class Command(BaseCommand)... | {
"content_hash": "78593edf2c02f1879028e93aed5e8261",
"timestamp": "",
"source": "github",
"line_count": 248,
"max_line_length": 117,
"avg_line_length": 51.16532258064516,
"alnum_prop": 0.5163527464733233,
"repo_name": "navijo/FlOYBD",
"id": "d2f86762c61287ed4fba1735983cad9a053810e9",
"size": "12689... |
from PySide import QtCore, QtGui
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
Dialog.resize(606, 443)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerti... | {
"content_hash": "44fc09ffdde28b18f5e2201cb1a9c569",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 145,
"avg_line_length": 64.58620689655173,
"alnum_prop": 0.7245061398825414,
"repo_name": "tzimm/SeRe",
"id": "356004d5efe3479de9a543b6bd7a0bf663de09bd",
"size": "9612",
... |
"""User interface for Win32 terminals."""
#
# (C) Pywikibot team, 2003-2015
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, unicode_literals
__version__ = '$Id$'
import re
from pywikibot.userinterfaces import (
terminal_interface_base,
win32_unicode,
)
try:
... | {
"content_hash": "5f73f51994a3afbe9b6aac090066f726",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 82,
"avg_line_length": 25.41304347826087,
"alnum_prop": 0.5945252352437981,
"repo_name": "smalyshev/pywikibot-core",
"id": "43db049d0ea121cd998b7719e8f5a99d3cd4f623",
"size... |
import npyscreen
class HelpForm(npyscreen.ActionFormWithMenus):
""" Help form for the Vent CLI """
@staticmethod
def switch(page):
def popup(page):
info_str = ''
if page == 'Menu':
info_str = """
Menu interactions are simple! Here is a quick... | {
"content_hash": "434ac253a2a6192cd5e278b59dc17591",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 79,
"avg_line_length": 52.00653594771242,
"alnum_prop": 0.5885383938670353,
"repo_name": "CyberReboot/vent",
"id": "906e3fac29396cb4347e43b944c2bb6b754ef167",
"size": "795... |
import json
import logging
import os
import os.path
import pickle
import random
import resource
import signal
import socket
import subprocess
import sys
import threading
import time
import traceback
import addict
import psutil
from pymesos import Executor, MesosExecutorDriver, decode_data, encode_data
from urllib.requ... | {
"content_hash": "9c7b212f8b82a8b634c7142fc181a529",
"timestamp": "",
"source": "github",
"line_count": 294,
"max_line_length": 133,
"avg_line_length": 40.105442176870746,
"alnum_prop": 0.6042744466118226,
"repo_name": "BD2KGenomics/slugflow",
"id": "bffa456061ca8ca3cefac43f2383e01684f5b17d",
"size... |
from django.contrib.syndication.views import Feed
from django.db.transaction import non_atomic_requests
from django.utils.decorators import method_decorator
class NonAtomicFeed(Feed):
"""
A feed that does not use transactions.
Feeds are special because they don't inherit from generic Django class
vie... | {
"content_hash": "5b3a2a7ea1d880ae2fb7227b64b846d9",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 74,
"avg_line_length": 32.375,
"alnum_prop": 0.7181467181467182,
"repo_name": "andymckay/addons-server",
"id": "1afb0863216192bc975b1187d1ded504360ace3d",
"size": "518",
... |
from .mod import InplusTraderBacktestMod
def load_mod():
return InplusTraderBacktestMod()
| {
"content_hash": "860ce892c2241fa1d62f5889ae70dc3b",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 40,
"avg_line_length": 19.2,
"alnum_prop": 0.78125,
"repo_name": "zhengwsh/InplusTrader_Linux",
"id": "7c32a462f9ec4b67cf3f365c8455052a33571622",
"size": "701",
"binary": ... |
"""This module contains report plugin mocks used for testing."""
from grr_response_core.lib import rdfvalue
from grr_response_core.lib import utils
from grr_response_server.gui.api_plugins.report_plugins import rdf_report_plugins
from grr_response_server.gui.api_plugins.report_plugins import report_plugin_base
from g... | {
"content_hash": "efa561154bd5d5aa8d590a0d119eb95a",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 81,
"avg_line_length": 34.5,
"alnum_prop": 0.679549114331723,
"repo_name": "google/grr",
"id": "e9f952eea1170e6996e177c91953705994aac9f0",
"size": "2506",
"binary": false... |
"""
plot_grid.py
Class instance used to make Display.
"""
# Load the needed packages
import numpy as np
import os
import pyart
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as \
NavigationToolbar
from matplotlib.figure import F... | {
"content_hash": "8ef244fd84a0176b2e0eeb73b5a5f957",
"timestamp": "",
"source": "github",
"line_count": 1138,
"max_line_length": 78,
"avg_line_length": 36.63796133567663,
"alnum_prop": 0.5508226603348204,
"repo_name": "jjhelmus/artview",
"id": "ff329630712f06fddc6a13313263ea75047fd60b",
"size": "41... |
"""IPython Test Suite Runner.
This module provides a main entry point to a user script to test IPython
itself from the command line. There are two ways of running this script:
1. With the syntax `iptest all`. This runs our entire test suite by
calling this script (with different arguments) recursively. This
c... | {
"content_hash": "c122fa92f8aca52d36320475dfad74ff",
"timestamp": "",
"source": "github",
"line_count": 518,
"max_line_length": 86,
"avg_line_length": 35.285714285714285,
"alnum_prop": 0.6167523799102747,
"repo_name": "wolfram74/numerical_methods_iserles_notes",
"id": "ecc1ee457cc6614acc088f0931649d5... |
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_gurrcat.iff"
result.attribute_template_id = 9
result.stfName("monster_name","tusk_cat")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "6109028f296ed5f6414d47595411efa1",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 53,
"avg_line_length": 21.846153846153847,
"alnum_prop": 0.6866197183098591,
"repo_name": "obi-two/Rebelion",
"id": "63648c0ff557a4dd835e06dfcfc06f81a55d081c",
"size": "429... |
"""Generates user-friendly single-band IPHAS DR2 detection catalogues.
Summary
-------
This module is used to transform the IPHAS detection tables that are kindly
provided by the ``imcore`` source detection and measurement tool of the
Cambridge Astronomical Survey Unit (CASU). Its main purpose is to convert the
column... | {
"content_hash": "22c6f37a79ca7864be29aa1052c0edc0",
"timestamp": "",
"source": "github",
"line_count": 1298,
"max_line_length": 83,
"avg_line_length": 43.301232665639446,
"alnum_prop": 0.5471577261809447,
"repo_name": "barentsen/iphas-dr2",
"id": "c632c61ce5dfc7f163d92734f29c5e9e955e947b",
"size":... |
from django.template import Context, Template
from django.test import TestCase
class TestTags(TestCase):
def render_template(self, string, context=None):
"""
helper function for template tag testing, from https://stackoverflow.com/a/1690879/
:param string:
:param context:
... | {
"content_hash": "23bfd59b577520413c411766398f5f74",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 120,
"avg_line_length": 31.555555555555557,
"alnum_prop": 0.6038732394366197,
"repo_name": "Benoss/django-cookiecutter",
"id": "4117bad321d090e77938f83baef9874b6e004796",
"... |
from __future__ import division # Standardmäßig float division - Ganzzahldivision kann man explizit mit '//' durchführen
from __future__ import absolute_import
import numpy as np
import math
import pygame
from pyecs import *
from pycompupipe.other import child_support_points
from pycompupipe.other import MathUtils... | {
"content_hash": "63f000d32cd84220425d99488f0a87fe",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 123,
"avg_line_length": 35.370370370370374,
"alnum_prop": 0.5968586387434555,
"repo_name": "xaedes/PyCompuPipe",
"id": "04ab8b71018d7559038b3bea93a7ff4c5ac7c902",
"size": "... |
from base import BaseBot
from scraping import movement
class MovementBot(BaseBot):
"""Logging functions for the bot"""
def __init__(self, browser, config, planets):
self.movement_scraper = movement.Movement(browser, config)
super(MovementBot, self).__init__(browser, config, planets)
def... | {
"content_hash": "2f106c8832841998d7aac85d663a599c",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 76,
"avg_line_length": 37.85,
"alnum_prop": 0.6776750330250991,
"repo_name": "winiciuscota/OG-Bot",
"id": "dd3eeef5298f705da1e7523e1ce109051130810f",
"size": "757",
"bina... |
'''Reads alignments in PSL format and FASTA format and extract a region or
a sequence that do not mapped to a reference sequence.
A script requires a -singleHit parameter for pslRep.
'''
import sys
from collections import namedtuple
from Bio import SeqIO
from Bio.SeqRecord import SeqRecord
from Bio.Seq import Seq
Se... | {
"content_hash": "c4708ed1dd0625596d38c536c61298a6",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 74,
"avg_line_length": 33.626666666666665,
"alnum_prop": 0.5400475812846947,
"repo_name": "likit/BioUtils",
"id": "8ef41152c9db34efa963063330ddf8b9f412641d",
"size": "2522"... |
""" Models for display visual shapes whose attributes can be associated
with data columns from data sources.
"""
from __future__ import absolute_import
from ..plot_object import PlotObject
from ..mixins import FillProps, LineProps, TextProps
from ..enums import Direction, Anchor
from ..properties import AngleSpec, Bo... | {
"content_hash": "2fb1e55ec163f4d95798df477413a121",
"timestamp": "",
"source": "github",
"line_count": 973,
"max_line_length": 119,
"avg_line_length": 26.082219938335047,
"alnum_prop": 0.6164788399401055,
"repo_name": "daodaoliang/bokeh",
"id": "cd15e0575fe6415967abbe568934fda1d0eb3ac8",
"size": "... |
""" order book on a security
"""
import logging
from sortedcontainers import SortedList
from orderbook.side import Side
from orderbook.trade import Trade
from orderbook.order_factory import create_order
class OrderBook:
""" implements a central limit order book on one security
"""
def __init__(self):
... | {
"content_hash": "8a8d0d54fd6e4f969ee1c9ca11e85c07",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 75,
"avg_line_length": 28.559055118110237,
"alnum_prop": 0.5340501792114696,
"repo_name": "martyw/central-limit-order-book",
"id": "43a7c4601366a909a6a629a5b05926e1cd2a772e"... |
"""
Test for weights in GLM, Poisson and OLS/WLS, continuous test_glm.py
Below is a table outlining the test coverage.
================================= ====================== ====== ===================== === ======= ======== ============== ============= ============== ============= ============== ==== =========
Tes... | {
"content_hash": "9c558334606afe19e6ebb258e4b1c367",
"timestamp": "",
"source": "github",
"line_count": 918,
"max_line_length": 194,
"avg_line_length": 43.15686274509804,
"alnum_prop": 0.510752688172043,
"repo_name": "josef-pkt/statsmodels",
"id": "5872380b60b739466e46339017c909975bf65e4e",
"size":... |
from __future__ import unicode_literals
import json
class ImmutableObject(object):
"""
Superclass for immutable objects whose fields can only be modified via the
constructor.
:param kwargs: kwargs to set as fields on the object
:type kwargs: any
"""
def __init__(self, *args, **kwargs):
... | {
"content_hash": "9f615ba7d99db7cea256c2d54b5e6254",
"timestamp": "",
"source": "github",
"line_count": 483,
"max_line_length": 79,
"avg_line_length": 29.434782608695652,
"alnum_prop": 0.5878877400295421,
"repo_name": "woutervanwijk/mopidy",
"id": "bedf8ca50b0777550a27d26fa8dd834c4a4e22e7",
"size":... |
"""Output formatters using shell syntax.
"""
from .base import SingleFormatter
import argparse
import six
class ShellFormatter(SingleFormatter):
def add_argument_group(self, parser):
group = parser.add_argument_group(
title='shell formatter',
description='a format a UNIX shell c... | {
"content_hash": "e48e0d3e10fcefd762b5d0013055d39e",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 79,
"avg_line_length": 31.093023255813954,
"alnum_prop": 0.5272999252056844,
"repo_name": "enzochiau/cliff",
"id": "e613c22ffaf49a0ccded9742a86ff2a20b537426",
"size": "1337... |
from zerorpc import zmq
import zerorpc
from testutils import teardown, random_ipc_endpoint
class MokupContext():
_next_id = 0
def new_msgid(self):
new_id = MokupContext._next_id
MokupContext._next_id += 1
return new_id
def test_context():
c = zerorpc.Context()
assert c.new_ms... | {
"content_hash": "60dd5323e6133bb7d5cd922f861cb254",
"timestamp": "",
"source": "github",
"line_count": 202,
"max_line_length": 72,
"avg_line_length": 28.797029702970296,
"alnum_prop": 0.6114835826027162,
"repo_name": "stdrickforce/zerorpc-python",
"id": "224a41cc2740e992927f18196471387330660339",
... |
from geopy.compat import u
from geopy.point import Point
from geopy.geocoders import Photon
from test.geocoders.util import GeocoderTestBase
class PhotonTestCase(GeocoderTestBase): # pylint: disable=R0904,C0111
@classmethod
def setUpClass(cls):
cls.geocoder = Photon()
cls.known_country_it = ... | {
"content_hash": "7ebdd9ae57ff6a29815e0e16edbfead5",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 70,
"avg_line_length": 27.337078651685392,
"alnum_prop": 0.528976572133169,
"repo_name": "Vimos/geopy",
"id": "41e42cebbcf57ac1722238ad2eee3c690db70f95",
"size": "2434",
... |
import os
import re
import mock
import shutil
import pickle
import tempfile
from unittest import TestCase
from mock import patch
from repoxplorer import index
from repoxplorer.index import commits
from repoxplorer.index import projects
from repoxplorer.indexer.git import indexer
class TestExtractCmtFunctions(TestCa... | {
"content_hash": "1ef98bd0e12843cd3edb24297d5b6109",
"timestamp": "",
"source": "github",
"line_count": 687,
"max_line_length": 77,
"avg_line_length": 40.2532751091703,
"alnum_prop": 0.5345700441165835,
"repo_name": "morucci/repoxplorer",
"id": "1342e0192d2437c3051e516f526ef59caa5262ed",
"size": "2... |
"""
tests.components.switch.test_mqtt
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tests mqtt switch.
"""
import unittest
from homeassistant.const import STATE_ON, STATE_OFF
import homeassistant.core as ha
import homeassistant.components.switch as switch
from tests.common import mock_mqtt_component, fire_mqtt_message
class Te... | {
"content_hash": "a410e34ece8fe8b5bfde1f073b4f73da",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 73,
"avg_line_length": 33.736363636363635,
"alnum_prop": 0.559687415790892,
"repo_name": "nevercast/home-assistant",
"id": "b7c20e5ff94fb535e5f9d4d097601132ac00033c",
"siz... |
"""The tests for the ASUSWRT device tracker platform."""
import os
import unittest
from unittest import mock
import voluptuous as vol
from homeassistant.bootstrap import _setup_component
from homeassistant.components import device_tracker
from homeassistant.components.device_tracker.asuswrt import (
CONF_PROTOCOL... | {
"content_hash": "8ddd00906d5f187fdf6fe0b62680a42b",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 79,
"avg_line_length": 37.24404761904762,
"alnum_prop": 0.5993287517979863,
"repo_name": "leoc/home-assistant",
"id": "a4d5ee64b3227128417a2e61631936df2d8026cd",
"size": "... |
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, BooleanField, SubmitField
from wtforms.validators import Required, Length, Email, Regexp, EqualTo
from wtforms import ValidationError
from ..models import User
class LoginForm(FlaskForm):
email = StringField('Email', validators=[Requi... | {
"content_hash": "92aecee170611b697b0ce5b27765bff4",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 80,
"avg_line_length": 46.15942028985507,
"alnum_prop": 0.6270015698587127,
"repo_name": "Tuklab/tuklab101",
"id": "91e247454e685d8547149fbcc6b09d28853d7778",
"size": "3185... |
import sys
from PyQt5.QtCore import QCoreApplication, Qt
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QApplication, QWidget, QMainWindow, QPushButton, QAction, QMessageBox
from PyQt5.QtWidgets import QCheckBox, QProgressBar, QComboBox, QLabel, QStyleFactory
from PyQt5.QtWidgets import QFontDialog
class w... | {
"content_hash": "45b9fbd414e022ade6c72f397cbde43d",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 97,
"avg_line_length": 30.652542372881356,
"alnum_prop": 0.615427149571468,
"repo_name": "kenwaldek/pythonprogramming",
"id": "ba5e0f29665f20018bce7f9fb2f4d382401f00ce",
"... |
"""SCons.Scanner.RC
This module implements the depenency scanner for RC (Interface
Definition Language) files.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associ... | {
"content_hash": "31c7bc7657c106deb3558c1a89db98c1",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 90,
"avg_line_length": 37.38181818181818,
"alnum_prop": 0.669260700389105,
"repo_name": "cournape/numscons",
"id": "2498d59dee0895200b0c03d009b2ab40c48f548a",
"size": "2056... |
import json
import os
import re
import sys
from unittest import mock
from urllib.parse import urlparse
import django
from django import test
from django.conf import settings
from django.test.client import RequestFactory
from django.test.utils import override_settings
from django.urls import reverse
import pytest
fr... | {
"content_hash": "bd796ef9a6a9102f9db9951440437778",
"timestamp": "",
"source": "github",
"line_count": 636,
"max_line_length": 88,
"avg_line_length": 39.30974842767296,
"alnum_prop": 0.6208151673933042,
"repo_name": "bqbn/addons-server",
"id": "7d7c3198f62581c11b90d45e166b5c7fcd178da0",
"size": "2... |
import os
import json
import sys
from Bio import SeqIO
"""
Add the fasta sequence to the JSON to have a single source of truth
"""
fasta_file = sys.argv[1]
json_file = sys.argv[2]
out_file = sys.argv[3]
# Gather the fasta sequences
fasta_dict = {}
with open(fasta_file, 'r') as fastafh:
for record in SeqIO.parse(... | {
"content_hash": "880c0ae3d9bd8a3dbe4752a002671a56",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 67,
"avg_line_length": 23.342105263157894,
"alnum_prop": 0.6144306651634723,
"repo_name": "phac-nml/ecoli_serotyping",
"id": "ce1eb9cfc61f41262e2c8eb38b1a97c76cfae603",
"si... |
import logging
from belogging.loader import BeloggingLoader
loader = BeloggingLoader(json=True)
loader.setup()
logger = logging.getLogger('foo')
logger.info('foo')
| {
"content_hash": "88f5ccc8df6e42a58b61a4cd154d11b3",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 44,
"avg_line_length": 16.8,
"alnum_prop": 0.7797619047619048,
"repo_name": "georgeyk/belogging",
"id": "4fcfa050962452a0421c5e09e36b7bd74002634d",
"size": "168",
"binary... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Application',
fields=[
... | {
"content_hash": "e42a2c6b9805254d8b53550ecbbfa7f1",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 152,
"avg_line_length": 37.91379310344828,
"alnum_prop": 0.55025011368804,
"repo_name": "lizardsystem/lizard-apps",
"id": "3265d4f43408acfa0c802a9d21f4e0b6dac04c62",
"size"... |
"""
Replay Parsing
~~~~~~~~~~~~~~
World of Tanks replay parsing and information extraction
"""
import json
import struct
import pickle
from copy import copy
from .constants import WOT_TANKS
def parse_replay(replay_blob):
"""
Parse the replay file and return the extracted information as Pyth... | {
"content_hash": "e7e690a8d2ae52d5dc3ef3412bdb7758",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 114,
"avg_line_length": 35.902702702702705,
"alnum_prop": 0.5897320084311954,
"repo_name": "ceari/whyattend",
"id": "d24a749dc5fda8a9043de362c07d50845d46c3e5",
"size": "66... |
"""
.. module:: lesscpy.plib.identifier
:synopsis: Identifier node.
Copyright (c)
See LICENSE for details.
.. moduleauthor:: Johann T. Mariusson <[email protected]>
"""
import re
from .node import Node
from lesscpy.lessc import utility
from lesscpy.lib import reserved
class Identifier(Node):
"""Identifie... | {
"content_hash": "65a1fbfa1446ee780ca6c98bf5a4cc1f",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 115,
"avg_line_length": 37.81656804733728,
"alnum_prop": 0.4334219996870599,
"repo_name": "fivethreeo/lesscpy",
"id": "68c55c7ceda4a18747d44e5c732d8f84f464c3f0",
"size": "... |
from shelve import Shelf
import pytc
from shelf_with_hooks import ShelfWithHooks
class PytcHashShelf(ShelfWithHooks):
DB_CLASS = pytc.HDB
def __init__(self, filename, flag, key_type='str', dump_method='json',
cached=True, writeback=False):
db = self.DB_CLASS()
if flag == 'r... | {
"content_hash": "9343f00ae00567e103c3fea7d676f29c",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 74,
"avg_line_length": 23.63888888888889,
"alnum_prop": 0.5898942420681551,
"repo_name": "artemrizhov/pymorphy",
"id": "3673715c49d3024e70bd5f6c3c1f837ebbcf05e2",
"size": "... |
"""
Example use of LevelDB operators.
"""
from airflow import models
from airflow.providers.google.leveldb.operators.leveldb import LevelDBOperator
from airflow.utils.dates import days_ago
with models.DAG(
'example_leveldb',
start_date=days_ago(2),
schedule_interval=None,
tags=['example'],
) as dag:
... | {
"content_hash": "1fe07373ce25c63fc30fe91c82478fdb",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 104,
"avg_line_length": 30.9,
"alnum_prop": 0.6645091693635383,
"repo_name": "dhuang/incubator-airflow",
"id": "e4a732c71d6bff53274048d5d9c815175bef9f63",
"size": "1714",
... |
"""Database setup and migration commands."""
from oslo.config import cfg
from example.common import utils
CONF = cfg.CONF
CONF.import_opt('backend',
'example.openstack.common.db.api',
group='database')
IMPL = utils.LazyPluggable(
pivot='backend',
config_group='databas... | {
"content_hash": "8606a2800c7d67ee5be5e20bee9860e1",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 71,
"avg_line_length": 23.51851851851852,
"alnum_prop": 0.6614173228346457,
"repo_name": "JimJiangX/BoneDragon",
"id": "3c7be0dcd5a04c4dd1d52f2b83200901da3a1ad9",
"size": "... |
import uuid
import httpretty
from keystoneclient import exceptions
from keystoneclient.tests.v3 import utils
from keystoneclient.v3 import users
class UserTests(utils.TestCase, utils.CrudTests):
def setUp(self):
super(UserTests, self).setUp()
self.key = 'user'
self.collection_key = 'user... | {
"content_hash": "2e13c21f752d05f0dfa4afbd6013e7de",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 79,
"avg_line_length": 35.913513513513514,
"alnum_prop": 0.5684828416616496,
"repo_name": "citrix-openstack-build/python-keystoneclient",
"id": "92135ddaa70bae06432da4b4069c... |
import argparse
import sys
from mypyli import taxstring, kraken
def parse_kraken(kraken_f):
id_dict = {}
krak = kraken.KrakenRecord.parse_kraken_file(kraken_f, iterate=True)
for entry in krak:
if entry.classified:
id_dict[entry.name] = entry.tax_id
else:
id_dict[en... | {
"content_hash": "3fe5a66bf7edcfd5546eb9123a679518",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 102,
"avg_line_length": 32.04424778761062,
"alnum_prop": 0.5197459265396299,
"repo_name": "hunter-cameron/Bioinformatics",
"id": "b81e8fba8ac4eb2acb0b5acbb8df97d16ee9cfc6",
... |
import os
from setuptools import find_packages
from setuptools import setup
version = '0.01'
here = os.path.abspath(os.path.dirname(__file__))
try:
README = open(os.path.join(here, 'README.md')).read()
except IOError:
README = ''
install_requires = [
'numpy',
'Theano',
]
tests_require = [
'm... | {
"content_hash": "f6e07d5535164bb34d1a5324c1f1d7c7",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 57,
"avg_line_length": 20.625,
"alnum_prop": 0.6278787878787879,
"repo_name": "dereklarson/nnGen",
"id": "8cf5d1bd1a1fca2231fbaba3736c962d8e1b4b54",
"size": "825",
"binar... |
import numpy as np
from montemodes.classes.structure import Structure
from montemodes.analysis.symmetry_analysis import get_symmetry_analysis
import montemodes.analysis.distorsion as distorsion
import functions.shape
print functions.shape.get_info(vertices=4)
exit()
def random_alteration_coordinates_box(initial_co... | {
"content_hash": "c06458072e2b4dfbcbc2b633d1371690",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 122,
"avg_line_length": 41.69117647058823,
"alnum_prop": 0.5379188712522046,
"repo_name": "abelcarreras/MonteModes",
"id": "33fcaca68b260cdeed74117d14e409c232320fc0",
"size... |
for i, slot in enumerate(obj.material_slots):
| {
"content_hash": "1896775f8e3dbd119284e8fb7b9b1f1e",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 45,
"avg_line_length": 46,
"alnum_prop": 0.7608695652173914,
"repo_name": "MaxReimann/troen-simulator",
"id": "669c6d1e53a06b00b7957b572fa70809b2d8353c",
"size": "46",
"bi... |
import os
from cached_property import cached_property
from airflow.configuration import conf
from airflow.utils.log.file_task_handler import FileTaskHandler
from airflow.utils.log.logging_mixin import LoggingMixin
class S3TaskHandler(FileTaskHandler, LoggingMixin):
"""
S3TaskHandler is a python log handler ... | {
"content_hash": "86f7d9ca186c71239e3e9da71891ad8a",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 81,
"avg_line_length": 39.44871794871795,
"alnum_prop": 0.6103347416314592,
"repo_name": "Fokko/incubator-airflow",
"id": "569c34d5cbc0358f65c6c7e712a6e34b0e0e7788",
"size... |
from sympy import Basic as SympyBasic, I, exp, sqrt
from .core.circuit_algebra import (
CIdentity, CPermutation, Circuit, Concatenation, Feedback, SLH,
SeriesInverse, SeriesProduct, circuit_identity as cid)
from .core.exceptions import CannotSimplify, IncompatibleBlockStructures
from .core.hilbert_space_algebr... | {
"content_hash": "d95d88c61815de660389766c57c081e6",
"timestamp": "",
"source": "github",
"line_count": 1124,
"max_line_length": 79,
"avg_line_length": 37.60943060498221,
"alnum_prop": 0.5368438483192581,
"repo_name": "mabuchilab/QNET",
"id": "8ea2dba7fac56a106549bf6b504939c3724dd3a2",
"size": "422... |
from .celery import app as celery_app
__version__ = "0.1.0"
| {
"content_hash": "d49b22d9c33dfd6176e57e630cd3236d",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 37,
"avg_line_length": 20.333333333333332,
"alnum_prop": 0.6557377049180327,
"repo_name": "fladi/qraz",
"id": "f4cff8859c6696a2ee9188817f9d837e222cfa01",
"size": "108",
"b... |
import json
from .traversable import Traversable
def load(*args, **kwargs):
j = json.load(*args, **kwargs)
return Traversable(j)
def loads(*args, **kwargs):
j = json.loads(*args, **kwargs)
return Traversable(j)
def dump(obj, *args, **kwargs):
if isinstance(obj, Traversable):
obj = obj... | {
"content_hash": "813fbc0bd3b972c5d175a58fc07f9e9b",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 68,
"avg_line_length": 19.046511627906977,
"alnum_prop": 0.6275946275946276,
"repo_name": "skorokithakis/jsane",
"id": "eb846de8cdcbb6483b92914bc1fb915e72550fdb",
"size": "... |
"""Project Euler - Problem 73 Module"""
from fractions import Fraction
from problem0071 import closest_neighbor_fraction
# Smallest Distance if 7 & new_d have no common devisors
# 2: 1/2
# 3: 1/3 & 2/3
# 4: 1/4 (2/4) 3/4
# 5: 1/5 2/5 3/5 4/5
# 6: 1/6 (2/6) (3/6) (4/6) 5/6
# -> Nr of values for d == phi(d)
# Only Cou... | {
"content_hash": "21a84835d885c5c5670f5c7bd89b9b99",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 82,
"avg_line_length": 29.571428571428573,
"alnum_prop": 0.6086956521739131,
"repo_name": "rado0x54/project-euler",
"id": "b77fd3849860fecf60b6f58f7d376fb4982318bc",
"size"... |
from __future__ import absolute_import
from nearpy.engine import Engine
| {
"content_hash": "49eb9e64c8a9750b87d7473ab70ca8a1",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 38,
"avg_line_length": 24.333333333333332,
"alnum_prop": 0.7945205479452054,
"repo_name": "pombredanne/NearPy",
"id": "7dab4edfcd7410952b8d0517f926e4a571e848ad",
"size": "11... |
import asyncio
from unittest.mock import MagicMock
# local imports
from nautilus.network.events.consumers import KafkaBroker
loop = asyncio.get_event_loop()
def async_test(test_function):
"""
This decorator wraps a test function and executes it on the asyncio
event loop.
"""
def function(... | {
"content_hash": "2fb9cead498b2343f5b45869141446a5",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 75,
"avg_line_length": 25.09090909090909,
"alnum_prop": 0.6630434782608695,
"repo_name": "aaivazis/nautilus",
"id": "4a876115ccd7ec7fea48390657f4235c89d94caa",
"size": "571... |
from allauth.socialaccount.providers.base import ProviderAccount
from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider
class BasecampAccount(ProviderAccount):
def get_avatar_url(self):
return None
def to_str(self):
dflt = super(BasecampAccount, self).to_str()
retu... | {
"content_hash": "02dd7a992fe4734dc091c36667b925f9",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 77,
"avg_line_length": 30.076923076923077,
"alnum_prop": 0.6351236146632566,
"repo_name": "rsalmaso/django-allauth",
"id": "f2600a72afb10a9044421751c626fcc85f6390be",
"size... |
from nova.openstack.common import log as logging
from nova.openstack.common.plugin import plugin
LOG = logging.getLogger(__name__)
class _CallbackNotifier(object):
"""Manages plugin-defined notification callbacks.
For each Plugin, a CallbackNotifier will be added to the
notification driver list. Calls... | {
"content_hash": "4f4743e890a655defe47dedd51cc95f5",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 78,
"avg_line_length": 35.44871794871795,
"alnum_prop": 0.6517179023508137,
"repo_name": "gspilio/nova",
"id": "c08ee69fbd60b9a3bd20e2daf729d04bfaaad023",
"size": "3402",
... |
"""Integration tests for the `fluview_meta` endpoint."""
# standard library
import unittest
# third party
import mysql.connector
# first party
from delphi.epidata.client.delphi_epidata import Epidata
class FluviewMetaTests(unittest.TestCase):
"""Tests the `fluview_meta` endpoint."""
@classmethod
def setUpCl... | {
"content_hash": "b717044578e0150ec730947c64bc52e5",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 85,
"avg_line_length": 27.253333333333334,
"alnum_prop": 0.5929549902152642,
"repo_name": "cmu-delphi/delphi-epidata",
"id": "137e9464a854a7a059003fcab380fe43a12306f0",
"si... |
"""
Documents module views
"""
from django.shortcuts import get_object_or_404
from maker.core.rendering import render_to_response
from maker.documents.forms import FolderForm, DocumentForm, FileForm, FilterForm, WebLinkForm, \
MassActionForm
from django.template import RequestCont... | {
"content_hash": "1fd635c0b8c68e00e821882274ba4aa4",
"timestamp": "",
"source": "github",
"line_count": 788,
"max_line_length": 111,
"avg_line_length": 39.44796954314721,
"alnum_prop": 0.5978767894482869,
"repo_name": "alejo8591/maker",
"id": "baf44d71d1139554009c4745106c04f4a4bd4a94",
"size": "311... |
import hsm
from hsm import actor
from hsm import runtime
class Machine(actor.TopState):
def __init__(self):
self._error = None
def on_error(self, error):
self._error = error
self.transition(ErrorState)
@actor.initial_state
class Off(Machine):
def on_start(self):
self.transition(On)
class On(Machine):... | {
"content_hash": "ec1040e4b3742dd70d7a46560d4e7a7c",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 83,
"avg_line_length": 22.51063829787234,
"alnum_prop": 0.6502835538752363,
"repo_name": "eneabio/hsm",
"id": "7ba376a2b80f8fa142977f708cf2ed11d366f556",
"size": "1058",
... |
from os_win import exceptions as os_win_exc
from unittest import mock
from oslo_config import cfg
from nova import exception
from nova.objects import migrate_data as migrate_data_obj
from nova.tests.unit import fake_instance
from nova.tests.unit.virt.hyperv import test_base
from nova.virt.hyperv import livemigrationo... | {
"content_hash": "89c113824de2c349331f11bd856fbb1b",
"timestamp": "",
"source": "github",
"line_count": 224,
"max_line_length": 79,
"avg_line_length": 46.205357142857146,
"alnum_prop": 0.6079227053140097,
"repo_name": "openstack/nova",
"id": "79cb4318c58e0a7c60c2c9b6a4f514100732b188",
"size": "1098... |
import logging
from collections import defaultdict
from androguard.decompiler.dad.basic_blocks import (CatchBlock,
Condition,
LoopBlock,
ShortCircuitBlock,
... | {
"content_hash": "c25183ced6aa35b3e827fdbdc0e179ac",
"timestamp": "",
"source": "github",
"line_count": 420,
"max_line_length": 79,
"avg_line_length": 35.00238095238095,
"alnum_prop": 0.5328889191211482,
"repo_name": "xysec/androguard",
"id": "c8882a0d0bf779e95d9f2c8903bc58a05c8d6a97",
"size": "153... |
import logging
import configparser
from novaclient import client as novaclient
from neutronclient.v2_0 import client as neutronclient
import utils
from neutronapi import NeutronIF
logging.basicConfig(level=logging.INFO)
class Booter():
"""
Boots the corresponding topology.
"""
def __init__(self, topo... | {
"content_hash": "6ed402d5f1b3103198ac5a693c44b1bf",
"timestamp": "",
"source": "github",
"line_count": 341,
"max_line_length": 89,
"avg_line_length": 36.32551319648094,
"alnum_prop": 0.5393557762170017,
"repo_name": "nachtkatze/openstack-controller",
"id": "53ce2f774db699f92473d2e9e649c0e74cdf2586",... |
import pymongo
from scrapy.exceptions import DropItem
from scrapy.conf import settings
from scrapy import log
class MongoDBPipeline(object):
def __init__(self):
connection = pymongo.Connection(
settings['MONGODB_SERVER'], settings['MONGODB_PORT'])
db = connection[settings['MONGODB_DB... | {
"content_hash": "e8bcd5efb10b447db552f8df64f4e9b0",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 77,
"avg_line_length": 34.233333333333334,
"alnum_prop": 0.5813047711781889,
"repo_name": "benregn/itu-courses",
"id": "a579805b2f2ddb73064f5fe52f84965cda249ba6",
"size": "... |
from .counter import Counter # noqa
from .functions import deep_update # noqa
from .functions import ensure_string, ensure_tuple # noqa
from .functions import fix_trailing_slash, remove_trailing_slash # noqa
from .functions import get_class_name, get_instance_name, get_method_name # noqa
from .functions impor... | {
"content_hash": "32c6e9f5a60fdc1ac4bfec6383d0dc63",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 82,
"avg_line_length": 52.142857142857146,
"alnum_prop": 0.7589041095890411,
"repo_name": "ondrejkajinek/pyGrim",
"id": "fb923e0361e58c340873980a3f63e0ee4f51099f",
"size": "... |
"""Support for monitoring the Transmission BitTorrent client API."""
import logging
from homeassistant.const import CONF_NAME, STATE_IDLE
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity import Entity
from .const import DOM... | {
"content_hash": "fdd01415b2007ddf285c4bd8edcc5538",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 88,
"avg_line_length": 34.05555555555556,
"alnum_prop": 0.5793230016313213,
"repo_name": "postlund/home-assistant",
"id": "0db731d6f01322654d78071aed47b10c295d460c",
"size... |
"""Base class for TopicModel's REST calls
https://bigml.com/api/topicmodels
"""
try:
import simplejson as json
except ImportError:
import json
from bigml.api_handlers.resourcehandler import ResourceHandlerMixin
from bigml.api_handlers.resourcehandler import check_resource_type, \
resource_is_ready
f... | {
"content_hash": "3e2401bfd422a4db850a388255f5c0b6",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 79,
"avg_line_length": 36.61682242990654,
"alnum_prop": 0.6186830015313936,
"repo_name": "jaor/python",
"id": "6a1d0bb96fbe28355d202b2177f4b1d1a1c605a2",
"size": "4552",
... |
"""This module contains objects representing Telegram bot command scopes."""
from typing import Any, Union, Optional, TYPE_CHECKING, Dict, Type
from telegram import TelegramObject, constants
from telegram.utils.types import JSONDict
if TYPE_CHECKING:
from telegram import Bot
class BotCommandScope(TelegramObject... | {
"content_hash": "5f38796345cc2ae1d0a3a16cb02bd2ba",
"timestamp": "",
"source": "github",
"line_count": 244,
"max_line_length": 99,
"avg_line_length": 37.442622950819676,
"alnum_prop": 0.6609019264448336,
"repo_name": "tzpBingo/github-trending",
"id": "283f7682b2044a560b860556acb6444dacbeb851",
"si... |
from django.urls import include, re_path
from .versioning import __versions__
apipatterns = [
re_path(
rf"^{version.__version__}/",
include(
(f"{version.__name__}.urls", "bananas"),
namespace=version.__version__,
),
)
for version in __versions__
]
urlpatte... | {
"content_hash": "35b858ca9fca242f775d4b3f2a1e6bfb",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 85,
"avg_line_length": 23.41176470588235,
"alnum_prop": 0.5678391959798995,
"repo_name": "5monkeys/django-bananas",
"id": "2fcca266b4ddcb01162f728d981272cea545c77c",
"size"... |
import json
from django.contrib import messages as contrib_messages
from django.contrib.auth.models import User
from django.http import (HttpResponseRedirect, HttpResponse,
HttpResponseBadRequest)
from django.views.decorators.http import require_POST
from django.shortcuts import get_object_or_... | {
"content_hash": "21f2007e741b5dfdfbc022c83e9343a6",
"timestamp": "",
"source": "github",
"line_count": 197,
"max_line_length": 84,
"avg_line_length": 35.619289340101524,
"alnum_prop": 0.6300413282029357,
"repo_name": "Osmose/kitsune",
"id": "f6e5765456f8478108f4c9555e32179520db5953",
"size": "7017... |
import sys
import numpy
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
ext_modules = [
Extension("nerven.epoc._parse",
sources=["src/nerven/epoc/_parse.pyx"],
include_dirs=[".", numpy.get_include()]),
]
setup(name='nerven',
... | {
"content_hash": "b657736782c0f9c131fd363fe7ec8794",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 58,
"avg_line_length": 25.733333333333334,
"alnum_prop": 0.5803108808290155,
"repo_name": "fractalcat/nerven",
"id": "36a1a048eabeab6406cdc96b0c32f4dc5191b891",
"size": "77... |
import warnings
import pytest
import numpy as np
from numpy import testing as npt
import erfa
from astropy import units as u
from astropy.time import Time
from astropy.coordinates.builtin_frames import ICRS, AltAz
from astropy.coordinates.builtin_frames.utils import get_jd12
from astropy.coordinates import EarthLocat... | {
"content_hash": "4e9928db78e3427bb3d003a0de3b5161",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 106,
"avg_line_length": 41.96629213483146,
"alnum_prop": 0.6550200803212851,
"repo_name": "StuartLittlefair/astropy",
"id": "0dac266b2d23a46584894777ea516aa4534f5630",
"si... |
from __future__ import print_function
import argparse
import boto3
import botocore
import os
import sys
import aws_sudo.CommandParser
from six.moves import configparser
def sudo(cmd_args):
profile_config = read_config(cmd_args.profile)
credentials = {}
profile_config['session_timeout'] = cmd_args.sessio... | {
"content_hash": "e3996aebf5f5bfc2a2dddeec7fd72fce",
"timestamp": "",
"source": "github",
"line_count": 187,
"max_line_length": 81,
"avg_line_length": 34.37967914438503,
"alnum_prop": 0.6680665733395551,
"repo_name": "voytek-solutions/aws-sudo",
"id": "c9c19191e90cb9144dc37be04d55ff86a5c92ca2",
"si... |
__author__ = 'ossama' | {
"content_hash": "63591e32cdf3cbbac1cb306a258fd45e",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 21,
"avg_line_length": 21,
"alnum_prop": 0.5714285714285714,
"repo_name": "Shabaka/grafo",
"id": "589cd72666538f5319b148ff659495acb693aa32",
"size": "21",
"binary": false,... |
import sqlite3
_db = sqlite3.connect('dashboard.db')
c = _db.cursor()
# Create table
c.execute(
'''
CREATE TABLE ticketData
(
baseurl,
ticketid,
status
)
''')
| {
"content_hash": "6c18977decb757b2df29fb4ed0178951",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 37,
"avg_line_length": 11.125,
"alnum_prop": 0.6179775280898876,
"repo_name": "beeldengeluid/divedashboard-ui",
"id": "ed5b4d0029109fbff7ac6e199fc04725df622e8e",
"size": "1... |
import logging
from collections import namedtuple
from django.conf import settings
from django.db import IntegrityError
import six
from celery.result import GroupResult
from corehq.util.metrics import metrics_counter
from soil.exceptions import TaskFailedError
TaskProgress = namedtuple('TaskProgress',
... | {
"content_hash": "d9424b69695996793ca2e7e53cfacba2",
"timestamp": "",
"source": "github",
"line_count": 254,
"max_line_length": 91,
"avg_line_length": 29.381889763779526,
"alnum_prop": 0.5934610746348653,
"repo_name": "dimagi/commcare-hq",
"id": "081a2e96c2771c12f3003aa19fbf104ec9065ea0",
"size": "... |
import os
import tensorflow
def module_to_path(module):
file = module.__file__
sep = os.sep
return file[file.rfind("site-packages") + len("site-packages") + len(sep):-len("__init__.py") - len(sep)].replace(sep, ".")
root = tensorflow # or tensorflow.compat.v1
module_type = type(tensorflow)
print('\n'.j... | {
"content_hash": "08fd1133775ad2461d178fac429cd947",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 127,
"avg_line_length": 32.470588235294116,
"alnum_prop": 0.5887681159420289,
"repo_name": "JetBrains/intellij-community",
"id": "3bc79027d3418e62216e8554a0fb614c30cc3e01",
... |
from django.db import models
from django.conf import settings
class Event(models.Model):
name = models.CharField(max_length=100)
location = models.CharField(max_length=100)
date = models.DateTimeField()
last_modified = models.DateTimeField(auto_now=True)
def __str__(self):
return '{} at {... | {
"content_hash": "838f3ebc9dea2a6415884a77f6c0c779",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 94,
"avg_line_length": 27.733333333333334,
"alnum_prop": 0.6714743589743589,
"repo_name": "leepgent/rdec",
"id": "3d6f799e231704002f8a5d55e59f22c70b3c9f31",
"size": "1248",... |
from solution import NumArray
nums = [-2, 0, 3, -5, 2, -1]
numArray = NumArray(nums)
print(numArray.sumRange(0, 2))
print(numArray.sumRange(2, 5))
print(numArray.sumRange(0, 5))
| {
"content_hash": "b5db8d482c6ada20d5ca0f4256bbd7d0",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 30,
"avg_line_length": 25.571428571428573,
"alnum_prop": 0.6983240223463687,
"repo_name": "zhlinh/leetcode",
"id": "b5fcf14487dfeb974fcf3f8975a733659e0137e4",
"size": "226",... |
"""
Description here
"""
import logging as log
import unittest
import pytransmission.popgen.moran as m
import os
import tempfile
log.basicConfig(level=log.DEBUG, format='%(asctime)s %(levelname)s: %(message)s')
class MoranModelTest(unittest.TestCase):
def test_basic_watkins_convergence(self):
pop = 100... | {
"content_hash": "f0811f413dcd30fc8cab5770ffb9697d",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 81,
"avg_line_length": 24.142857142857142,
"alnum_prop": 0.6145393068469992,
"repo_name": "mmadsen/pytransmission",
"id": "e9f6453c3137567f905467e4ff1dbcee768a39e8",
"size"... |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Difference'] , ['LinearTrend'] , ['Seasonal_Second'] , ['SVR'] ); | {
"content_hash": "16d7d4f57fed5bb46d1d938f40ccd4d4",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 88,
"avg_line_length": 40.25,
"alnum_prop": 0.7142857142857143,
"repo_name": "antoinecarme/pyaf",
"id": "bbfa6940b7136581e123734c1fe56491181edb6b",
"size": "161",
"binary"... |
#!/usr/bin/env pythons
import sys
import subprocess
import time
import threading
import traceback
import json
import signal
from bin import eva_var
from bin import eva_utils
conf = eva_var.conf
stat = eva_var.stat
common = eva_var.common
def parse_input():
conf_file = sys.argv[1]
if l... | {
"content_hash": "43b719dff0c24b08829178b1ce1a6b19",
"timestamp": "",
"source": "github",
"line_count": 312,
"max_line_length": 178,
"avg_line_length": 44.64102564102564,
"alnum_prop": 0.5613153360137851,
"repo_name": "yvxiang/tera",
"id": "f4d1bd28b36245df0c1ab1ef83d691eda8327820",
"size": "14091"... |
from netforce.model import Model, fields
import time
class CartPromotion(Model):
_name = "ecom.cart.promotion"
_fields = {
"cart_id": fields.Many2One("ecom.cart", "Cart", required=True, on_delete="cascade"),
"promotion_id": fields.Many2One("sale.promotion","Promotion",required=True),
"... | {
"content_hash": "a9bbbcc3616d300572fb3617b42cc61e",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 92,
"avg_line_length": 37.526315789473685,
"alnum_prop": 0.6479663394109397,
"repo_name": "sidzan/netforce",
"id": "ca63187fbbd6f87ef8e2ec9afeea299c84be9a59",
"size": "1818... |
class StopDispatching(StopIteration):
def __init__(self):
self.returnValue = None
class Dispatcher(object):
def __init__(self):
self._listeners = {}
def fire(self, name, *args, **kwargs):
if not self.hasListeners(name):
return
for listener in self._listeners[... | {
"content_hash": "b9acc45d51f627740e3dd2459905663d",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 58,
"avg_line_length": 24.96875,
"alnum_prop": 0.590738423028786,
"repo_name": "mtils/ems",
"id": "5e1abd2a656471adebf4153561e42287ad4070f8",
"size": "800",
"binary": fal... |
import re
import debug, tests
from common import TestCommon, TimeoutError
from results import RawResults
class BulkTestCommon(TestCommon):
use_memcpy = None
def get_module_name(self):
return "bulkbench"
def get_build_targets(self, build, machine):
targets = super(BulkTestCommon, self).get... | {
"content_hash": "38275355cbf2234939bb47817a8ae392",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 82,
"avg_line_length": 35.357142857142854,
"alnum_prop": 0.601010101010101,
"repo_name": "modeswitch/barrelfish",
"id": "7496ba90054ff575569f25c45a5cadacd89f4948",
"size": ... |
'''
Syntax:
variable = input('prompt label')
print('result text', variable)
when run, the input() field will
note: differences between python 2 and 3.
in 2, if you want to use user input as a string, you must use raw_imput(). vers 3 naturally interprets input() as string
'''
myname = input('please enter your name:... | {
"content_hash": "83304fed9bc0e9895926d49c76768455",
"timestamp": "",
"source": "github",
"line_count": 286,
"max_line_length": 120,
"avg_line_length": 18.32867132867133,
"alnum_prop": 0.6785578023655093,
"repo_name": "lexrhodd/py_fun",
"id": "2b99b53312ee5b48796bb68b51238d746cb0382a",
"size": "537... |
from .iht import *
from .fasta import *
from .zeroSR1 import *
from .proxes import *
from .wavelet import *
from .iswt import *
from .iuwt import *
from .alps import *
from .smooth import *
from .proxes_rank1 import *
from .damp import *
from .bsbl import *
| {
"content_hash": "72bebdf3b2b3831312aea97ed972db4a",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 27,
"avg_line_length": 21.75,
"alnum_prop": 0.7088122605363985,
"repo_name": "aasensio/pyiacsun",
"id": "f5f86cfc3ae4140a33ffd2c9f37131fe3dae1919",
"size": "261",
"binary... |
import os
from google.appengine.runtime import DeadlineExceededError
from werkzeug import (
BaseResponse, Request
)
from kay.utils.test import Client
from kay.app import get_application
from kay.conf import LazySettings
from kay.ext.testutils.gae_test_base import GAETestBase
class BadUrlsTestCase(GAETestBase):
... | {
"content_hash": "17e0d10a8c3cf162cdb6b8e5e352d1c5",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 82,
"avg_line_length": 27.875,
"alnum_prop": 0.7548579970104634,
"repo_name": "gmist/kay-ru",
"id": "bff0bba9d9ab230fffe6a2b676283cfe0fda6139",
"size": "670",
"binary": f... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import logging
from datetime import datetime, timedelta
import time
from sqlalchemy import Table, Column, Integer, Float, Unicode, DateTime, Date, func
from sqlalchemy.ext... | {
"content_hash": "457f7df681d31a24515c43e45305e2f8",
"timestamp": "",
"source": "github",
"line_count": 244,
"max_line_length": 115,
"avg_line_length": 38.93032786885246,
"alnum_prop": 0.5985893251921255,
"repo_name": "LynxyssCZ/Flexget",
"id": "e8ada464419a9d2206e7ae7b5c29e9447a5c64b7",
"size": "9... |
"""The test for sensor device automation."""
import pytest
import homeassistant.components.automation as automation
from homeassistant.components.sensor import DOMAIN
from homeassistant.components.sensor.device_condition import ENTITY_CONDITIONS
from homeassistant.const import (
CONF_PLATFORM,
DEVICE_CLASS_BAT... | {
"content_hash": "66723dfa88265e6cf415bd90d3746a87",
"timestamp": "",
"source": "github",
"line_count": 450,
"max_line_length": 88,
"avg_line_length": 33.11555555555555,
"alnum_prop": 0.5497248691450812,
"repo_name": "jawilson/home-assistant",
"id": "5742f7b47c4c0ba144376497f9741beb62fe6f29",
"size... |
from google.cloud import aiplatform_v1beta1
def sample_update_dataset():
# Create a client
client = aiplatform_v1beta1.DatasetServiceClient()
# Initialize request argument(s)
dataset = aiplatform_v1beta1.Dataset()
dataset.display_name = "display_name_value"
dataset.metadata_schema_uri = "meta... | {
"content_hash": "05ef079c5f0044338e6867ada1cb4056",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 70,
"avg_line_length": 28.083333333333332,
"alnum_prop": 0.7255192878338279,
"repo_name": "googleapis/python-aiplatform",
"id": "6dd3ad3ce168e7e1280e9cff763d42d72c034890",
... |
"""Tensorflow V1 version of the text vectorization preprocessing layer."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.keras.engine import base_preprocessing_layer_v1
from tensorflow.python.keras.layers.preprocessing import index... | {
"content_hash": "d6e49ce23f348f8985f3b63b3580f531",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 79,
"avg_line_length": 48.02,
"alnum_prop": 0.7413577675968347,
"repo_name": "annarev/tensorflow",
"id": "c710108dd5ba74f7e5a4f2eb3d4f5d48aaf8ce59",
"size": "3090",
"bina... |
__author__ = 'huqinghua'
# coding=gbk
import string, os, commands, time
from PyUI import *
from MsgBox import *
from PyFrameBase import *
def ShowMessageBox(hwnd, title, caption):
mbox1 = PyFrameCreator()
obj = mbox1.CreateForm(hwnd, 'MsgBox', 'MsgBox')
obj.SetText("LblCaption", title)
o... | {
"content_hash": "450ad82cceb996888c1b0cf22f6655a9",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 52,
"avg_line_length": 23.5,
"alnum_prop": 0.6622340425531915,
"repo_name": "est/py-ui4win",
"id": "4bad4f3ab67c70233d46c1ed24bdfbafef91650e",
"size": "376",
"binary": fa... |
"""This example adds a text add that uses advanced features of upgraded URLS.
The LoadFromStorage method is pulling credentials and properties from a
"googleads.yaml" file. By default, it looks for this file in your home
directory. For more information, see the "Caching authentication information"
section of our READM... | {
"content_hash": "21c8f92b1d7556e1988396cd8f2f0267",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 79,
"avg_line_length": 34.785714285714285,
"alnum_prop": 0.612496333235553,
"repo_name": "cctaylor/googleads-python-lib",
"id": "cca69d0c63fa90249cb4792816724844e7491eae",
... |
from __future__ import unicode_literals
import copy
import ecstasy
import oauth2client.file
import pytest
import requests
from collections import namedtuple
import tests.paths
import lnk.googl.stats
import lnk.googl.info
import lnk.config
VERSION = 1
API = 'https://www.googleapis.com/urlshortener'
KEY = 'AIzaSyAoXK... | {
"content_hash": "712188591de8f64b5a6591a0db4dfb36",
"timestamp": "",
"source": "github",
"line_count": 426,
"max_line_length": 76,
"avg_line_length": 25.812206572769952,
"alnum_prop": 0.6622408148417607,
"repo_name": "goldsborough/lnk",
"id": "6575de4e088257795c46d99b3a9bf2271170c587",
"size": "11... |
from flask import Blueprint, current_app, send_from_directory
eventum = Blueprint('eventum', __name__)
@eventum.route('/static/<path:filename>', methods=['GET'])
def static(filename):
return send_from_directory(current_app.config['EVENTUM_STATIC_FOLDER'],
filename)
| {
"content_hash": "12f690c1662fce1f8ba1065c887c4ecf",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 75,
"avg_line_length": 33.77777777777778,
"alnum_prop": 0.6611842105263158,
"repo_name": "danrschlosser/eventum",
"id": "38c977e35c17f7da6f0e1bd6dfb86989b084c99b",
"size": "... |
"""
pygments.lexers.compiled
~~~~~~~~~~~~~~~~~~~~~~~~
Just export lexer classes previously contained in this module.
:copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.lexers.jvm import JavaLexer, ScalaLexer
from pygments.l... | {
"content_hash": "1febcbe61c5464b4da00ae0ee647217a",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 78,
"avg_line_length": 41.24242424242424,
"alnum_prop": 0.8104335047759,
"repo_name": "sonntagsgesicht/regtest",
"id": "13aa39ce2d57100b096f1e5913b1371e04ad941d",
"size": "... |
from typing import Tuple, Callable, Optional, List, TypeVar
from ..model import Model
from ..config import registry
from ..types import Floats1d, Floats2d, Floats3d, Floats4d, FloatsXd, Ragged, Padded
# fmt: off
InT = TypeVar("InT", List[Floats1d], List[Floats2d], List[Floats3d], List[Floats4d], Ragged, Padded, Floa... | {
"content_hash": "e6880bf79a168c8c96640d4b844670f0",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 110,
"avg_line_length": 32.328125,
"alnum_prop": 0.5935234412759788,
"repo_name": "spacy-io/thinc",
"id": "612c008c6fce780e1071538e6fe6634e066d0fc2",
"size": "2069",
"bin... |
from __future__ import absolute_import
from . import pubnub # noqa
from . import requests # noqa
| {
"content_hash": "791f06c834652b9e11f3b9a3d7d61c73",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 38,
"avg_line_length": 25,
"alnum_prop": 0.72,
"repo_name": "victorlin/bugbuzz-python",
"id": "d0a5f4005929512d97e15c9614f83b545a0d3356",
"size": "100",
"binary": false,
... |
from unittest import mock
from nova.objects import external_event as external_event_obj
from nova.tests.unit.objects import test_objects
class _TestInstanceExternalEventObject(object):
def test_make_key(self):
key = external_event_obj.InstanceExternalEvent.make_key('foo', 'bar')
self.assertEqual(... | {
"content_hash": "f11e584c885d6b0282d79057a61fdbdc",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 78,
"avg_line_length": 36.26829268292683,
"alnum_prop": 0.6260928043039677,
"repo_name": "mahak/nova",
"id": "58c45c25497399b7944aed4a1e274390ff157db3",
"size": "2096",
"... |
import re
from random import randrange
def test_phones_on_home_page(app):
index = 0
user_from_home_page = app.user.get_user_list()[index]
user_from_edit_page = app.user.get_user_info_from_edit_page(index)
assert user_from_home_page.all_phones_from_home_page == merge_phones_like_on_home_page(user_from_... | {
"content_hash": "78815c15c6a53c3a6a225d118fd4cc7a",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 115,
"avg_line_length": 40.5,
"alnum_prop": 0.6534979423868312,
"repo_name": "VanillaPupa/python_training",
"id": "fc4c3e535d0675aba2ddd4f27ca713590bb7614d",
"size": "1215"... |
from eve import Eve
from eve_sqlalchemy import SQL as _SQL
from eve_sqlalchemy.validation import ValidatorSQL
from config import config
from .core import db
from .models import Contact
class SQL(_SQL):
driver = db
def create_app(config_name):
app = Eve(validator=ValidatorSQL, data=SQL, settings=config[con... | {
"content_hash": "6145b54d190d35e0226f2c7f67ab852a",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 90,
"avg_line_length": 20.476190476190474,
"alnum_prop": 0.7418604651162791,
"repo_name": "abkfenris/proof_companion",
"id": "fa3503d67b66d462566308f93833d99fa5e13d51",
"si... |
import sys, os
sys.path.insert(0, os.path.abspath('../readthedocs'))
import settings.sqlite
from django.core.management import setup_environ
setup_environ(settings.sqlite)
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx']
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project =... | {
"content_hash": "a78ee9a3a878c47a9d270efc9fd4d7fe",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 63,
"avg_line_length": 32.648648648648646,
"alnum_prop": 0.6879139072847682,
"repo_name": "alex/readthedocs.org",
"id": "950f83e60ab63c80c18b67c126765811f22d0dd6",
"size": ... |
from accounts.models import JournalWriter
from journal import status_codes
from utils.response_utils import JournalResponse
class LoginRequiredMixin(object):
def check_user(self, request):
user = request.user
if user.is_authenticated() and user.is_active and JournalWriter.objects.get(user=user):
... | {
"content_hash": "3d26b76aefa304e9895cbd66cf5307c3",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 95,
"avg_line_length": 36.388888888888886,
"alnum_prop": 0.6992366412213741,
"repo_name": "subramaniank/journal",
"id": "54804673f0b7385e77ceec322bdb40e49cddc383",
"size": ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.