text stringlengths 0 1.05M | meta dict |
|---|---|
from dtest import Tester, debug, DISABLE_VNODES
import unittest
from ccmlib.cluster import Cluster
from ccmlib.node import Node, NodeError, TimeoutError
import time, re
from assertions import assert_invalid, assert_all, assert_none, assert_one
import tempfile
import os
class TestCompaction(Tester):
__test__= Fals... | {
"repo_name": "tjake/cassandra-dtest",
"path": "compaction_test.py",
"copies": "1",
"size": "8304",
"license": "apache-2.0",
"hash": 7773369724817111000,
"line_mean": 37.4444444444,
"line_max": 206,
"alpha_frac": 0.5914017341,
"autogenerated": false,
"ratio": 3.8605299860529985,
"config_test": ... |
from dtest import Tester, debug
from assertions import *
from tools import *
from os.path import getsize
import time
class TestSSTableSplit(Tester):
def split_test(self):
"""
Check that after running compaction, sstablessplit can succesfully split
The resultant sstable. Check that split ... | {
"repo_name": "pcmanus/cassandra-dtest",
"path": "sstablesplit_test.py",
"copies": "2",
"size": "1907",
"license": "apache-2.0",
"hash": -8729569919149814000,
"line_mean": 34.9811320755,
"line_max": 125,
"alpha_frac": 0.5909805978,
"autogenerated": false,
"ratio": 3.6885880077369437,
"config_te... |
from dtest import Tester, debug
from tools.assertions import assert_all
from tools.decorators import since
class CompatibilityFlagTest(Tester):
"""
Test 30 protocol compatibility flag
@jira CASSANDRA-13004
"""
def _compatibility_flag_off_with_30_node_test(self, from_version):
"""
... | {
"repo_name": "spodkowinski/cassandra-dtest",
"path": "upgrade_tests/compatibility_flag_test.py",
"copies": "4",
"size": "4728",
"license": "apache-2.0",
"hash": -6143104765328516000,
"line_mean": 34.8181818182,
"line_max": 133,
"alpha_frac": 0.6446700508,
"autogenerated": false,
"ratio": 3.58725... |
from dtest import Tester, debug
from tools import since
import subprocess, tempfile, os, shutil
@since('3.0')
class TestValidation(Tester):
__test__= False
def prepare(self):
"""
Sets up cluster to test against. Currently 3 CCM Nodes
"""
cluster = self.cluster
cluster... | {
"repo_name": "tjake/cassandra-dtest",
"path": "validation.py",
"copies": "1",
"size": "4467",
"license": "apache-2.0",
"hash": 2686825015298328600,
"line_mean": 35.9173553719,
"line_max": 122,
"alpha_frac": 0.5914483994,
"autogenerated": false,
"ratio": 4.013477088948787,
"config_test": true,
... |
from dtest import Tester, debug
from tools import since
from cassandra.concurrent import execute_concurrent_with_args
from jmxutils import JolokiaAgent, make_mbean
class TestUpgradeIndexSummary(Tester):
@since('2.1')
def test_upgrade_index_summary(self):
cluster = self.cluster
cluster.popul... | {
"repo_name": "tjake/cassandra-dtest",
"path": "index_summary_upgrade_test.py",
"copies": "1",
"size": "3900",
"license": "apache-2.0",
"hash": -8271786795523847000,
"line_mean": 40.4893617021,
"line_max": 133,
"alpha_frac": 0.6453846154,
"autogenerated": false,
"ratio": 3.7320574162679425,
"co... |
from dtest import Tester, debug
import datetime
import random
status_messages = (
"I''m going to the Cassandra Summit in June!",
"C* is awesome!",
"All your sstables are belong to us.",
"Just turned on another 50 C* nodes at <insert tech startup here>, scales beautifully.",
"Oh, look! Cats, on redd... | {
"repo_name": "yukim/cassandra-dtest",
"path": "wide_rows_test.py",
"copies": "2",
"size": "4665",
"license": "apache-2.0",
"hash": -2357807225477249500,
"line_mean": 44.2912621359,
"line_max": 133,
"alpha_frac": 0.5894962487,
"autogenerated": false,
"ratio": 3.8939899833055094,
"config_test": ... |
from dtest import Tester, debug, TracingCursor, PRINT_DEBUG
from tools import *
from ccmlib.cluster import Cluster
import re
import os
import time
from collections import defaultdict
TRACE_DETERMINE_REPLICAS = re.compile('Determining replicas for mutation')
TRACE_SEND_MESSAGE = re.compile('Sending message to /([0-9]+\... | {
"repo_name": "pcmanus/cassandra-dtest",
"path": "replication_test.py",
"copies": "1",
"size": "10118",
"license": "apache-2.0",
"hash": 4454816788009378300,
"line_mean": 41.3347280335,
"line_max": 98,
"alpha_frac": 0.5939909073,
"autogenerated": false,
"ratio": 3.9647335423197494,
"config_test... |
from dtest import Tester
from assertions import *
import os, sys, time, tools
from ccmlib.cluster import Cluster
class TestDeletion(Tester):
def gc_test(self):
""" Test that tombstone are fully purge after gc_grace """
cluster = self.cluster
cluster.populate(1).start()
[node1] = ... | {
"repo_name": "josh-mckenzie/cassandra-dtest",
"path": "deletion_test.py",
"copies": "2",
"size": "1396",
"license": "apache-2.0",
"hash": -8355083386396780000,
"line_mean": 31.4651162791,
"line_max": 91,
"alpha_frac": 0.5845272206,
"autogenerated": false,
"ratio": 3.588688946015424,
"config_te... |
from dtest import Tester
from cassandra import ConsistencyLevel
from cassandra.query import SimpleStatement
import random, time, uuid
from assertions import assert_invalid, assert_one
from tools import rows_to_list, since
class TestCounters(Tester):
def simple_increment_test(self):
""" Simple incrementat... | {
"repo_name": "yukim/cassandra-dtest",
"path": "counter_tests.py",
"copies": "2",
"size": "10139",
"license": "apache-2.0",
"hash": 6021907828331602000,
"line_mean": 35.7355072464,
"line_max": 137,
"alpha_frac": 0.557155538,
"autogenerated": false,
"ratio": 4.085012087026591,
"config_test": tru... |
from dtest import Tester
from tools import *
from assertions import *
import os, sys, time
from ccmlib.cluster import Cluster
class TestRangeGhosts(Tester):
def ghosts_test(self):
""" Check range ghost are correctly removed by the system """
cluster = self.cluster
cluster.populate(1).star... | {
"repo_name": "josh-mckenzie/cassandra-dtest",
"path": "range_ghost_test.py",
"copies": "2",
"size": "1437",
"license": "apache-2.0",
"hash": 1812695100745765000,
"line_mean": 28.3265306122,
"line_max": 77,
"alpha_frac": 0.5720250522,
"autogenerated": false,
"ratio": 3.7036082474226806,
"config... |
from dtest import Tester
import os, sys, time
from ccmlib.cluster import Cluster
from tools import require, since
from jmxutils import make_mbean, JolokiaAgent
class TestDeletion(Tester):
def gc_test(self):
""" Test that tombstone are fully purge after gc_grace """
cluster = self.cluster
... | {
"repo_name": "tjake/cassandra-dtest",
"path": "deletion_test.py",
"copies": "1",
"size": "2588",
"license": "apache-2.0",
"hash": -4149969662629648000,
"line_mean": 33.5066666667,
"line_max": 91,
"alpha_frac": 0.6213292117,
"autogenerated": false,
"ratio": 3.483176312247645,
"config_test": tru... |
from dtest import Tester
import os, sys, time
from ccmlib.cluster import Cluster
class TestRangeGhosts(Tester):
def ghosts_test(self):
""" Check range ghost are correctly removed by the system """
cluster = self.cluster
cluster.populate(1).start()
[node1] = cluster.nodelist()
... | {
"repo_name": "yukim/cassandra-dtest",
"path": "range_ghost_test.py",
"copies": "2",
"size": "1202",
"license": "apache-2.0",
"hash": 2812915758827950000,
"line_mean": 28.3170731707,
"line_max": 77,
"alpha_frac": 0.578202995,
"autogenerated": false,
"ratio": 3.6096096096096097,
"config_test": f... |
from dtest import Tester
import os, sys, time, re
from uuid import UUID
from ccmlib.cluster import Cluster
def assert_columns(cli, names):
assert not cli.has_errors(), cli.errors()
output = cli.last_output()
for name in names:
assert re.search('name=%s' % name, output) is not None, 'Cannot find c... | {
"repo_name": "yukim/cassandra-dtest",
"path": "super_column_cache_test.py",
"copies": "1",
"size": "1430",
"license": "apache-2.0",
"hash": -535829155288519900,
"line_mean": 32.2558139535,
"line_max": 166,
"alpha_frac": 0.5909090909,
"autogenerated": false,
"ratio": 3.5660847880299253,
"config... |
from DTL.api import BaseDict, Enum, apiUtils
VersionStatus = Enum('Alpha','Beta','Gold')
class Version(BaseDict):
def __init__(self, *args, **kwds):
self.__setitem__('major',0)
self.__setitem__('minor',0)
self.__setitem__('fix',0)
self.__setitem__('status',VersionStatus.Alpha)
... | {
"repo_name": "rocktavious/DevToolsLib",
"path": "DTL/api/version.py",
"copies": "1",
"size": "1679",
"license": "mit",
"hash": -1056033809803657,
"line_mean": 37.1590909091,
"line_max": 102,
"alpha_frac": 0.5098272781,
"autogenerated": false,
"ratio": 4.501340482573727,
"config_test": false,
... |
from DTL.api import BaseDict
#------------------------------------------------------------
#------------------------------------------------------------
class DotifyDict(BaseDict):
#------------------------------------------------------------
def __eq__(self, other):
return dict.__eq__(self, other)
... | {
"repo_name": "rocktavious/DevToolsLib",
"path": "DTL/api/dotifydict.py",
"copies": "1",
"size": "2363",
"license": "mit",
"hash": -3470801958773419500,
"line_mean": 38.4,
"line_max": 104,
"alpha_frac": 0.4033008887,
"autogenerated": false,
"ratio": 5.070815450643777,
"config_test": false,
"h... |
from DTL.api import InternalError, Path
from DTL.db import BaseData
from DTL.db import StringProperty, FloatProperty, IntegerProperty, BooleanProperty, ListProperty, CustomDataProperty
#------------------------------------------------------------
#------------------------------------------------------------
class Nod... | {
"repo_name": "rocktavious/DevToolsLib",
"path": "DTL/db/data.py",
"copies": "1",
"size": "2385",
"license": "mit",
"hash": -4545567903483908600,
"line_mean": 36.8571428571,
"line_max": 116,
"alpha_frac": 0.4096436059,
"autogenerated": false,
"ratio": 4.917525773195877,
"config_test": false,
... |
from DTL.db.base import BaseProperty
#------------------------------------------------------------
def typename(obj):
"""Returns the type of obj as a string. More descriptive and specific than
type(obj), and safe for any object, unlike __class__."""
if hasattr(obj, '__class__'):
return getattr(obj,... | {
"repo_name": "rocktavious/DevToolsLib",
"path": "DTL/db/properties.py",
"copies": "1",
"size": "10347",
"license": "mit",
"hash": -5211379653451360000,
"line_mean": 39.2645914397,
"line_max": 111,
"alpha_frac": 0.4702812409,
"autogenerated": false,
"ratio": 5.220484359233098,
"config_test": fa... |
from DTL.qt import QtCore, QtGui
from DTL.qt.QtCore import Qt
#------------------------------------------------------------
#------------------------------------------------------------
class GraphicsItemModel(QtGui.QGraphicsItem):
unselected_color = QtGui.QColor(100,100,100)
selected_color = QtGui.QColor(100,... | {
"repo_name": "rocktavious/DevToolsLib",
"path": "DTL/db/models/graphicsmodels.py",
"copies": "1",
"size": "5650",
"license": "mit",
"hash": 3616835074011948500,
"line_mean": 36.4238410596,
"line_max": 94,
"alpha_frac": 0.4159292035,
"autogenerated": false,
"ratio": 5.295220243673852,
"config_t... |
from DTL.qt import QtCore, QtGui
from DTL.qt.QtCore import Qt
#------------------------------------------------------------
#------------------------------------------------------------
class SceneGraphModel(QtCore.QAbstractItemModel):
sortRole = Qt.UserRole
filterRole = Qt.UserRole + 1
#----------------... | {
"repo_name": "rocktavious/DevToolsLib",
"path": "DTL/db/models/scenegraphmodel.py",
"copies": "1",
"size": "4329",
"license": "mit",
"hash": -6720160759213801000,
"line_mean": 33.9193548387,
"line_max": 81,
"alpha_frac": 0.4451374451,
"autogenerated": false,
"ratio": 5.377639751552795,
"config... |
from DTL.qt import QtCore, QtGui
from DTL.qt.QtCore import Qt
#------------------------------------------------------------
#------------------------------------------------------------
class TableModel(QtCore.QAbstractTableModel):
#------------------------------------------------------------
def __init__(self... | {
"repo_name": "rocktavious/DevToolsLib",
"path": "DTL/db/models/tablemodel.py",
"copies": "1",
"size": "3928",
"license": "mit",
"hash": -8475362021772771000,
"line_mean": 32.8706896552,
"line_max": 76,
"alpha_frac": 0.4447556008,
"autogenerated": false,
"ratio": 5.094682230869001,
"config_test... |
from DTL.qt import QtCore, QtGui
from DTL.qt.QtCore import Qt
#------------------------------------------------------------
#------------------------------------------------------------
class ListModel(QtCore.QAbstractListModel):
#------------------------------------------------------------
def __init__(self,... | {
"repo_name": "rocktavious/DevToolsLib",
"path": "DTL/db/models/listmodel.py",
"copies": "1",
"size": "2389",
"license": "mit",
"hash": -2789532584061439000,
"line_mean": 33.6376811594,
"line_max": 73,
"alpha_frac": 0.411469234,
"autogenerated": false,
"ratio": 5.308888888888889,
"config_test":... |
from DTL.qt import QtGui
from DTL.api import apiUtils
from DTL.gui import Core, Dialog
#------------------------------------------------------------
#------------------------------------------------------------
class ProgressWidget(Dialog):
#------------------------------------------------------------
def onF... | {
"repo_name": "rocktavious/DevToolsLib",
"path": "DTL/gui/widgets/progresswidget.py",
"copies": "1",
"size": "1760",
"license": "mit",
"hash": -5279855559245525000,
"line_mean": 29.8771929825,
"line_max": 67,
"alpha_frac": 0.4056818182,
"autogenerated": false,
"ratio": 5,
"config_test": false,
... |
# from dto import *
# from dao import *
from service import PodService
import pd_util
import dao
import os
pd_util.init_dirs()
dao.init_database()
# list of podcasts to subscribe to:
sub_urls = [
('http://www.npr.org/rss/podcast.php?id=510208','Car Talk'),
('http://www.npr.org/rss/podcast.ph... | {
"repo_name": "tonyrein/podderewski",
"path": "src/testmain.py",
"copies": "1",
"size": "2025",
"license": "mit",
"hash": 4547994733872049700,
"line_mean": 43.0434782609,
"line_max": 112,
"alpha_frac": 0.6513580247,
"autogenerated": false,
"ratio": 2.9136690647482015,
"config_test": false,
"h... |
from dto import ProblemMetadata
from os import path
import os
import glob
import json
class ProblemProvider:
def __init__(self):
pass
def get_problem_metadata_by_id(self, problem_id: str) -> ProblemMetadata:
problem_metadata = ProblemMetadata()
problem_metadata.problem_id = problem_... | {
"repo_name": "AJudge-team/AJudge",
"path": "provider/problem_provider.py",
"copies": "1",
"size": "1390",
"license": "mit",
"hash": 7255398253789249000,
"line_mean": 28.5744680851,
"line_max": 78,
"alpha_frac": 0.5877697842,
"autogenerated": false,
"ratio": 4.052478134110787,
"config_test": fa... |
from dto import ShopBaseDto
from rest_framework import serializers
__author__ = 'artem'
class LightProductDto(ShopBaseDto):
name = serializers.CharField()
@classmethod
def from_product_model(cls, product):
dto = cls()
dto.name = product.name
return dto.to_dict()
class LightCate... | {
"repo_name": "artemijan/shopcar",
"path": "shop/shop_api/categories/dto.py",
"copies": "1",
"size": "1448",
"license": "mit",
"hash": -4000938596980217300,
"line_mean": 30.4782608696,
"line_max": 96,
"alpha_frac": 0.6650552486,
"autogenerated": false,
"ratio": 3.693877551020408,
"config_test":... |
from dto import ShopBaseDto
from shop_core.model.profile import Profile
from rest_framework import serializers
__author__ = 'artem'
class SignInDto(ShopBaseDto):
username = serializers.CharField()
password = serializers.CharField()
permanent = serializers.BooleanField(default=False)
class SignUpDto(Sho... | {
"repo_name": "artemijan/shopcar",
"path": "shop/shop_api/auth/dto.py",
"copies": "1",
"size": "1487",
"license": "mit",
"hash": -483687744163517300,
"line_mean": 32.7954545455,
"line_max": 108,
"alpha_frac": 0.7209145931,
"autogenerated": false,
"ratio": 3.832474226804124,
"config_test": false... |
from dtree_util import *
import sys, cPickle, random, os
## CAUTION: you will most likely have to fiddle around with these functions to
## get them to do what you want. they are meant to help you get your data
## into the proper format for QANTA. send me an email if you have any questions
## ... | {
"repo_name": "CamdenCU/CSCI-5622_project",
"path": "preprocess/dparse_to_dtree.py",
"copies": "1",
"size": "5073",
"license": "mit",
"hash": -5071650750664111000,
"line_mean": 27.0276243094,
"line_max": 109,
"alpha_frac": 0.5407056968,
"autogenerated": false,
"ratio": 3.7689450222882614,
"conf... |
from dtreeviz.utils import *
import numpy as np
import pandas as pd
import graphviz
from pathlib import Path
from sklearn import tree
from graphviz.backend import run, view
import matplotlib.pyplot as plt
from dtreeviz.shadow import *
from numbers import Number
import matplotlib.patches as patches
from mpl_toolkits.mp... | {
"repo_name": "parrt/AniML",
"path": "dtreeviz/trees.py",
"copies": "1",
"size": "44977",
"license": "bsd-3-clause",
"hash": 6081983022444687000,
"line_mean": 37.5407026564,
"line_max": 175,
"alpha_frac": 0.5619094204,
"autogenerated": false,
"ratio": 3.4122600713147713,
"config_test": false,
... |
from .DtsTypes import *
def write_debug_report(filepath, shape):
with open(filepath, "w") as fd:
def p(line):
fd.write(line + "\n")
def gn(i):
return shape.names[i]
def ln(table, first, count):
def each(i):
entry = table[i]
... | {
"repo_name": "qoh/io_scene_dts",
"path": "write_report.py",
"copies": "2",
"size": "10225",
"license": "mit",
"hash": 332184008154685400,
"line_mean": 52.8157894737,
"line_max": 237,
"alpha_frac": 0.4939853301,
"autogenerated": false,
"ratio": 3.440444145356662,
"config_test": false,
"has_no... |
from .DtsTypes import Sequence, Trigger, Vector, Quaternion
from struct import pack, unpack, calcsize
from ctypes import c_byte, c_short, c_int
def read(fd, fmt):
return unpack(fmt, fd.read(calcsize(fmt)))
def write(fd, fmt, *values):
fd.write(pack(fmt, *values))
def write_quat(fd, q):
write(fd, "4h",
... | {
"repo_name": "qoh/io_scene_dts",
"path": "DsqFile.py",
"copies": "2",
"size": "6798",
"license": "mit",
"hash": -2738848153543425500,
"line_mean": 34.9682539683,
"line_max": 104,
"alpha_frac": 0.5376581347,
"autogenerated": false,
"ratio": 3.375372393247269,
"config_test": false,
"has_no_key... |
from dtypes.hash_table import Hash_Table
import pytest
def test_correct_size():
ht = Hash_Table(100)
assert ht.num_bins == 100
assert len(ht.table) == 100
def test_get():
"""Get only accepts Strings or lists of chars.
Raises an error for all other types."""
ht = Hash_Table(100)
for aType... | {
"repo_name": "jay-tyler/data-structures",
"path": "tests/test_hash_table.py",
"copies": "1",
"size": "1152",
"license": "mit",
"hash": -3029683409707049000,
"line_mean": 25.7906976744,
"line_max": 67,
"alpha_frac": 0.5998263889,
"autogenerated": false,
"ratio": 3.4183976261127595,
"config_test... |
from dualcontouring import tworesolution_dual_contour
from projection import create_parameters
from quad import Quad
import cPickle
import export_results
def transform_dict(cellsDict):
dataset = {}
for key in cellsDict:
dataset[key] = -1
return dataset
def read_from_path(path, coarse_scale):
... | {
"repo_name": "BGCECSE2015/CADO",
"path": "PYTHON/NURBSReconstruction/DualContouring/extraction.py",
"copies": "1",
"size": "2794",
"license": "bsd-3-clause",
"hash": 1625999192301827000,
"line_mean": 35.7631578947,
"line_max": 118,
"alpha_frac": 0.64817466,
"autogenerated": false,
"ratio": 3.318... |
from dualtree import dualtree, idualtree, approx_rec, detail_rec, dualtree_max_level, baseline
from dualtree._wavelets import dualtree_wavelet, dualtree_first_stage, kingsbury99, kingsbury99_fs, ALL_QSHIFT, ALL_FIRST_STAGE, ALL_COMPLEX_WAV
import numpy as n
import pywt
import unittest
n.random.seed(23)
############... | {
"repo_name": "LaurentRDC/dualtree",
"path": "dualtree/tests/test_dualtree.py",
"copies": "1",
"size": "5140",
"license": "mit",
"hash": -6751279958645583000,
"line_mean": 42.9401709402,
"line_max": 144,
"alpha_frac": 0.5912451362,
"autogenerated": false,
"ratio": 3.7381818181818183,
"config_te... |
from .duckling import Duckling
from .language import Language
from .dim import Dim
class DucklingWrapper(object):
"""Simplified Python wrapper for Duckling by wit.ai.
Attributes:
jvm_started: Optional attribute to specify if the JVM has already been
started (with all Java dependencies lo... | {
"repo_name": "FraBle/python-duckling",
"path": "duckling/wrapper.py",
"copies": "1",
"size": "23274",
"license": "apache-2.0",
"hash": 4882743799551660000,
"line_mean": 31.460251046,
"line_max": 111,
"alpha_frac": 0.4444444444,
"autogenerated": false,
"ratio": 4.154587647268833,
"config_test":... |
from dudu.buz import promotion
from dudu.buz import transactions
from dudu.buz import starbuzz
from dudu.buz.transactions import save_transactions
items=["DONUT:$1","LATTE:$2","FILTER:$4","MUFFIN:$3"]
prices=[1.00, 2.00, 4.00, 3.00]
running=True
while running:
option=1
for choice in items:
print(str(o... | {
"repo_name": "vollov/python-test",
"path": "dudu/buz/cafe_pos.py",
"copies": "1",
"size": "1176",
"license": "mit",
"hash": -4804579260272542000,
"line_mean": 31.6944444444,
"line_max": 72,
"alpha_frac": 0.5722789116,
"autogenerated": false,
"ratio": 3.721518987341772,
"config_test": false,
... |
from dudu.buz import promotion
from dudu.buz import transactions
from dudu.buz import starbuzz
from dudu.buz.transactions import save_transactions
items=["SHIRT:$5","SWEATER:$7","PANTS:$4","HAT:$3"]
prices=[5.00, 7.00, 4.00, 3.00]
running=True
while running:
option=1
for choice in items:
print(str(opt... | {
"repo_name": "vollov/python-test",
"path": "dudu/buz/clothingstore_pos.py",
"copies": "1",
"size": "1110",
"license": "mit",
"hash": -1852110749412968400,
"line_mean": 31.6764705882,
"line_max": 72,
"alpha_frac": 0.5792792793,
"autogenerated": false,
"ratio": 3.603896103896104,
"config_test": ... |
from dudu.buz import promotion
from dudu.buz import transactions
from dudu.buz import starbuzz
from dudu.buz.transactions import save_transactions
items=["WORKOUT:$15","BIKE:$5","WEIGHTS:$4","ENERGY DRINK:$3"]
prices=[15.00, 5.00, 4.00, 3.00]
running=True
while running:
option=1
for choice in items:
p... | {
"repo_name": "vollov/python-test",
"path": "dudu/buz/gym_pos.py",
"copies": "1",
"size": "1122",
"license": "mit",
"hash": -3446846522236825000,
"line_mean": 32.0294117647,
"line_max": 72,
"alpha_frac": 0.5828877005,
"autogenerated": false,
"ratio": 3.642857142857143,
"config_test": false,
"... |
from duel import app, db
from duel.models import Question, User
from duel.functions import get_random_question
from flask import render_template, request, redirect, url_for, session, abort, make_response
from flask_login import login_user, logout_user, current_user, login_required
import duel
import json
@app.route... | {
"repo_name": "rohankapoorcom/code-duel",
"path": "duel/views.py",
"copies": "1",
"size": "3348",
"license": "mit",
"hash": -3924727405522536400,
"line_mean": 33.875,
"line_max": 111,
"alpha_frac": 0.6502389486,
"autogenerated": false,
"ratio": 3.663019693654267,
"config_test": false,
"has_no... |
from dull.lexer import *
from dull.runtime import *
# Code representation:
# - Resolved: (ins, arg)
# - Unresolved: (ins, tag, labelName, posInLabelMap)
# Tag values for tagging unresolved labels
LBL_UNIQUE = {}
LBL_BEFORE = {}
LBL_AFTER = {}
PUNCTUATION = ".,:;!?"
VOWELS = "aeiouy"
class SyntaxError(Exception):
... | {
"repo_name": "eriksoe/dull-lang",
"path": "dull/assembler.py",
"copies": "1",
"size": "3781",
"license": "apache-2.0",
"hash": 1227272462077046500,
"line_mean": 28.0846153846,
"line_max": 97,
"alpha_frac": 0.5456228511,
"autogenerated": false,
"ratio": 3.6959921798631474,
"config_test": false,... |
from dulwich.repo import Repo
from dulwich.client import get_transport_and_path
import sys
def push(remote_url, repo_path='.'):
"""
Push to a remote repository
:param remote_url: <str> url of remote repository
:param repo_path: <str> path of local repository
:return refs: <dict> dictionary of ref-... | {
"repo_name": "mikofski/dulwichPorcelain",
"path": "push.py",
"copies": "1",
"size": "1159",
"license": "bsd-2-clause",
"hash": 5674024620827435000,
"line_mean": 38.9655172414,
"line_max": 71,
"alpha_frac": 0.5962036238,
"autogenerated": false,
"ratio": 3.6446540880503147,
"config_test": false,... |
from dulwich.repo import Repo
from dulwich.objects import Blob, Tree, Commit
import time
import os
import gitathing_git.settings as settings
def do_commit(repo, tree, blobs, message, author, ref = "master"):
commit = Commit()
commit.tree = tree.id
commit.author = commit.committer = author
commit.commi... | {
"repo_name": "iXce/git-a-thing",
"path": "gitathing_git/__init__.py",
"copies": "1",
"size": "1178",
"license": "apache-2.0",
"hash": -6829946549697611000,
"line_mean": 37,
"line_max": 91,
"alpha_frac": 0.6850594228,
"autogenerated": false,
"ratio": 3.327683615819209,
"config_test": false,
"... |
from dulwich.repo import Repo
from dulwich.objects import Tree, Blob, Commit, parse_timezone
from dulwich.errors import NotGitRepository
import os
import time
class GitDataSource(object):
""" A data source that stores all of it's data as a git repository. """
def create(self, filename, content='', reason='',... | {
"repo_name": "LimpidTech/pyramid-flatpages",
"path": "flatpages/data_sources/git.py",
"copies": "1",
"size": "11103",
"license": "mit",
"hash": 7559814488456125000,
"line_mean": 32.0446428571,
"line_max": 85,
"alpha_frac": 0.6135278753,
"autogenerated": false,
"ratio": 4.386803634926906,
"conf... |
from dumbyaml.exceptions import InvalidYAMLTypeConversion
from dumbyaml.exceptions import InvalidYAMLTypeComparison
import re
FLOAT_REGEXP = re.compile(r"^(\-|\+)?[0-9]+(\.[0-9]*)?$")
INT_REGEXP = re.compile("^(\-|\+)?[0-9]+$")
class YAMLNode(object):
"""Representation of a YAML node."""
def __init__(self,... | {
"repo_name": "crdoconnor/dumbyaml",
"path": "dumbyaml/yamlnode.py",
"copies": "1",
"size": "8688",
"license": "mit",
"hash": 8163913468942847000,
"line_mean": 33.3399209486,
"line_max": 79,
"alpha_frac": 0.5013812155,
"autogenerated": false,
"ratio": 4.5132467532467535,
"config_test": false,
... |
from DummyPlayer import *
from Card import *
from Deck import *
import copy
# Dada una lista de cartas que han sido lanzadas en ese orden y una carta de pinte, devuelve la posicion
# de la carta dentro de la lista que resulta ganadora con las reglas de la pocha.
def cartaGanadora(cartaDePinte, cartasJugadas):
cartas ... | {
"repo_name": "Rsilnav/PochaCompetition",
"path": "PochaCompetition/Game.py",
"copies": "1",
"size": "7844",
"license": "mit",
"hash": 6553598773124924000,
"line_mean": 33.7123893805,
"line_max": 142,
"alpha_frac": 0.7223355431,
"autogenerated": false,
"ratio": 2.4988849952214083,
"config_test"... |
from dumper import *
def qdump__FixedPoint(d, value):
d.putNumChild(3)
raw = [ value["v"]["s"][i].integer() for i in range( value["v"]["numWords"].integer() ) ]
ss = value["v"]["storageSize"].integer()
exp = [raw[i] * 2**(i * ss) for i in range(len(raw)) ]
if raw[-1] >= 2**(ss-1):
exp += [ ... | {
"repo_name": "Cat-Ion/FixedPoint",
"path": "util/fixedpoint-qtcreator.py",
"copies": "1",
"size": "1101",
"license": "mit",
"hash": 8961104412388601000,
"line_mean": 39.7777777778,
"line_max": 93,
"alpha_frac": 0.5640326975,
"autogenerated": false,
"ratio": 3.163793103448276,
"config_test": fa... |
from dump import Dump
from authorize import Authorize, DeAuthorize
from oslib import OSLibError
from oslib.command import Command, GenericExist, List, Delete
class Create(Command):
object = 'securitygroup'
verb = 'create'
def validate(self, options):
return True
def fill_parser(se... | {
"repo_name": "fbacchella/oscmd",
"path": "oslib/securitygroup/__init__.py",
"copies": "1",
"size": "1084",
"license": "apache-2.0",
"hash": 8430190437913702000,
"line_mean": 29.1111111111,
"line_max": 102,
"alpha_frac": 0.6466789668,
"autogenerated": false,
"ratio": 3.8303886925795054,
"config... |
from dump import Dump
from summary import Summary
from ssh import SSH
from ping import Ping
from offering import Offering
from associate import Associate
from newvolume import NewVolume
from start import Start
from console import Console
from attach import Attach
from terminate import Terminate
from windows import GetW... | {
"repo_name": "fbacchella/oscmd",
"path": "oslib/instance/__init__.py",
"copies": "1",
"size": "1582",
"license": "apache-2.0",
"hash": -2323245946708090000,
"line_mean": 26.7543859649,
"line_max": 169,
"alpha_frac": 0.6965865992,
"autogenerated": false,
"ratio": 3.748815165876777,
"config_test... |
from dump import GetIp
from summary import Summary
from oslib.command import Command, List
from oslib.ec2_objects import Instance
class Allocate(Command):
object = 'eip'
verb = 'allocate'
def validate(self, options):
return True
def execute(self, *args, **kwargs):
yield self.c... | {
"repo_name": "fbacchella/oscmd",
"path": "oslib/eip/__init__.py",
"copies": "1",
"size": "1668",
"license": "apache-2.0",
"hash": -3041819480717434400,
"line_mean": 26.8166666667,
"line_max": 94,
"alpha_frac": 0.6205035971,
"autogenerated": false,
"ratio": 3.571734475374732,
"config_test": fal... |
from dumptruck import DumpTruck
import datetime
import re
import os
def _connect(dbname = 'data.sqlite'):
'Initialize the database (again). This is mainly for testing'
global dt
dt = DumpTruck(dbname = dbname, adapt_and_convert = False)
_connect()
def execute(sqlquery, data=[], verbose=1):
""" Emulate scr... | {
"repo_name": "abdulla16/yp_python_scraper",
"path": "scraperwiki/sqlite.py",
"copies": "1",
"size": "3270",
"license": "bsd-2-clause",
"hash": -6786598203493521000,
"line_mean": 39.3703703704,
"line_max": 154,
"alpha_frac": 0.6458715596,
"autogenerated": false,
"ratio": 3.3956386292834893,
"co... |
from dumptruck import DumpTruck
import datetime
import re
import os
def _connect(dbname = 'scraperwiki.sqlite'):
'Initialize the database (again). This is mainly for testing'
global dt
dt = DumpTruck(dbname = dbname, adapt_and_convert = False)
_connect()
def execute(sqlquery, data=[], verbose=1):
""" Emul... | {
"repo_name": "openaustralia/scraperwiki-python",
"path": "scraperwiki/sqlite.py",
"copies": "1",
"size": "3277",
"license": "bsd-2-clause",
"hash": 5099921983621176000,
"line_mean": 39.4567901235,
"line_max": 154,
"alpha_frac": 0.6466280134,
"autogenerated": false,
"ratio": 3.395854922279793,
... |
from dungeonbot.conftest import BaseTest
from dungeonbot.plugins.roll import RollPlugin
from dungeonbot.models.roll import RollModel
from datetime import datetime
class RollModelTest(BaseTest):
"""Extended off of Basetest to test the Roll Model."""
def setUp(self):
"""Set up Attribute Model Tests."""... | {
"repo_name": "tlake/dungeonbot",
"path": "src/dungeonbot/tests/test_roll_model.py",
"copies": "1",
"size": "5173",
"license": "mit",
"hash": -6076879117153103000,
"line_mean": 37.0367647059,
"line_max": 95,
"alpha_frac": 0.5861202397,
"autogenerated": false,
"ratio": 3.46483590087073,
"config_... |
from dungeonbot.models import db
from datetime import datetime
from sqlalchemy.orm.exc import NoResultFound
from sqlalchemy.exc import IntegrityError
class AttrModel(db.Model):
"""Attribute Model."""
__table_args__ = {"extend_existing": True}
id = db.Column(db.Integer, primary_key=True)
key = db.Col... | {
"repo_name": "tlake/dungeonbot",
"path": "src/dungeonbot/models/attribute.py",
"copies": "1",
"size": "2355",
"license": "mit",
"hash": -505758378561321340,
"line_mean": 32.6428571429,
"line_max": 107,
"alpha_frac": 0.6004246285,
"autogenerated": false,
"ratio": 4.220430107526882,
"config_test... |
from dungeonbot.plugins.primordials import BangCommandPlugin
from dungeonbot.handlers.slack import SlackHandler
from dungeonbot.models.attribute import AttrModel
class AttrPlugin(BangCommandPlugin):
"""Misc. key/value storage for player stats."""
help_text = """
Command:
!attr + ADDITIONAL COMMAND
Addit... | {
"repo_name": "tlake/dungeonbot",
"path": "src/dungeonbot/plugins/attribute.py",
"copies": "1",
"size": "2623",
"license": "mit",
"hash": -6094996949078638000,
"line_mean": 28.4719101124,
"line_max": 77,
"alpha_frac": 0.5817765917,
"autogenerated": false,
"ratio": 4.054095826893354,
"config_tes... |
from dungeonbot.plugins.primordials import BangCommandPlugin
from dungeonbot.handlers.slack import SlackHandler
from dungeonbot.models.highlights import HighlightModel
import calendar
class HighlightPlugin(BangCommandPlugin):
"""Plugin for campaign Highlights."""
help_text = """
command:
!log + A... | {
"repo_name": "tlake/dungeonbot",
"path": "src/dungeonbot/plugins/highlights.py",
"copies": "1",
"size": "2225",
"license": "mit",
"hash": 2448134092387905000,
"line_mean": 30.7857142857,
"line_max": 74,
"alpha_frac": 0.6008988764,
"autogenerated": false,
"ratio": 4.230038022813688,
"config_tes... |
from dungeonfeature import new_stairs_up
import dungeonfeature
import terrain
import tile
from dungeonlevel import DungeonLevel
def get_empty_tile_matrix(width, height):
return [[tile.Tile()
for x in range(width)]
for y in range(height)]
def unknown_level_map(width, height, depth):
... | {
"repo_name": "co/TheLastRogue",
"path": "dungeonlevelfactory.py",
"copies": "1",
"size": "2030",
"license": "bsd-2-clause",
"hash": 5871712764641574000,
"line_mean": 26.4324324324,
"line_max": 68,
"alpha_frac": 0.6206896552,
"autogenerated": false,
"ratio": 3.2273449920508743,
"config_test": f... |
from DungeonMaster import bcolors
from random import randint
class InputManager:
correctCommand = False
def ParsePlayerInput(playerInput):
commandTokens = ["/yell", "/roll", "/say", "/grab", "/pickup", "/setRace"]
## by character
playerInputTokens = list(playerInput)
## by st... | {
"repo_name": "Carvuh/TerminalQuest",
"path": "PlayerInputManager.py",
"copies": "1",
"size": "2393",
"license": "mit",
"hash": 1397282145027864600,
"line_mean": 46.86,
"line_max": 102,
"alpha_frac": 0.5298788132,
"autogenerated": false,
"ratio": 4.154513888888889,
"config_test": false,
"has_... |
from DungeonMaster import DMTools
from DungeonMaster import bcolors
from PlayerInputManager import InputManager
class Player:
def characterCreation():
global playerRace
global playerName
global playableRaces
playableRaces = ["Human", "Dwarf", "Elf", "Halfling", "Dragonborn", "Gno... | {
"repo_name": "Carvuh/TerminalQuest",
"path": "CharacterSheet.py",
"copies": "1",
"size": "1171",
"license": "mit",
"hash": 6146905727216027000,
"line_mean": 36.7741935484,
"line_max": 96,
"alpha_frac": 0.6370623399,
"autogenerated": false,
"ratio": 3.7774193548387096,
"config_test": false,
"... |
from Dungeons import dungeon_music_addresses
from Text import string_to_alttp_text, text_addresses, credits_addresses, string_to_credits
from Text import Uncle_texts, Ganon1_texts, PyramidFairy_texts, TavernMan_texts, Sahasrahla2_texts, Triforce_texts, Blind_texts, BombShop2_texts
from Text import KingsReturn_texts, Sa... | {
"repo_name": "LLCoolDave/ALttPEntranceRandomizer",
"path": "Rom.py",
"copies": "1",
"size": "27929",
"license": "mit",
"hash": 1080212854659050100,
"line_mean": 56.5855670103,
"line_max": 281,
"alpha_frac": 0.6444913889,
"autogenerated": false,
"ratio": 2.5291134655437832,
"config_test": false... |
from dupe_eraser.src.core.files_eraser import remove_doublons
from dupe_eraser.src.getters.get_output_message import vprint, Message, vget
from path import Path
from typing import List, Dict
import progressbar
def dupe_eraser(*, main_directory: Path, hashing_algorithm: str,
recursive: bool, safe_mode:... | {
"repo_name": "NicolasBi/dupe_eraser",
"path": "dupe_eraser/src/core/files_finder.py",
"copies": "1",
"size": "5936",
"license": "apache-2.0",
"hash": -2322373188708506600,
"line_mean": 42.6470588235,
"line_max": 104,
"alpha_frac": 0.5786725067,
"autogenerated": false,
"ratio": 3.8873608382449247... |
from dupescan.criteria import (
evaluate,
lex,
)
from dupescan.criteria._common import ParseError
PROPERTY_GRAPH = None
OPERATOR_GRAPH = None
ADJECTIVE_GRAPH = None
MODIFIER_GRAPH = None
def lazy_init_module():
global PROPERTY_GRAPH, OPERATOR_GRAPH, ADJECTIVE_GRAPH, MODIFIER_GRAPH
if PROPERTY_GRAPH i... | {
"repo_name": "yellcorp/dupescan",
"path": "dupescan/criteria/parse.py",
"copies": "1",
"size": "6001",
"license": "mit",
"hash": 3766961693486523400,
"line_mean": 26.1538461538,
"line_max": 83,
"alpha_frac": 0.5474087652,
"autogenerated": false,
"ratio": 4.115912208504801,
"config_test": false... |
from durabledict.base import ConnectionDurableDict
from functools import wraps
import posixpath
def validate_key(func):
"""
Decorator to validate a key for zookeeper.
"""
@wraps(func)
def wrapper(self, key, *args, **kwargs):
if posixpath.sep in key:
raise ValueError('Keys can... | {
"repo_name": "disqus/durabledict",
"path": "durabledict/zookeeper.py",
"copies": "1",
"size": "10335",
"license": "apache-2.0",
"hash": 7985846464604564000,
"line_mean": 35.9107142857,
"line_max": 92,
"alpha_frac": 0.6239961297,
"autogenerated": false,
"ratio": 4.329702555509007,
"config_test"... |
from durabledict.base import ConnectionDurableDict
class RedisDict(ConnectionDurableDict):
"""
Dictionary-style access to a redis hash table. Populates a cache and a local
in-memory to avoid multiple hits to the database.
Functions just like you'd expect it::
mydict = RedisDict('my_redis_ke... | {
"repo_name": "disqus/durabledict",
"path": "durabledict/redis.py",
"copies": "1",
"size": "2819",
"license": "apache-2.0",
"hash": -4768609566655555000,
"line_mean": 32.9638554217,
"line_max": 80,
"alpha_frac": 0.5984391628,
"autogenerated": false,
"ratio": 4.004261363636363,
"config_test": fa... |
from durabledict.base import DurableDict
from durabledict.encoding import NoOpEncoding
class MemoryDict(DurableDict):
'''
Does not actually persist any data to a persistant storage. Instead, keeps
everything in memory. This is really only useful for use in tests
'''
def __init__(self, autosync... | {
"repo_name": "disqus/durabledict",
"path": "durabledict/memory.py",
"copies": "1",
"size": "1455",
"license": "apache-2.0",
"hash": -7927664361555402000,
"line_mean": 28.1,
"line_max": 79,
"alpha_frac": 0.6206185567,
"autogenerated": false,
"ratio": 3.953804347826087,
"config_test": false,
"... |
from durabledict.base import DurableDict
class ModelDict(DurableDict):
"""
Dictionary-style access to a model. Populates a cache and a local in-memory
to avoid multiple hits to the database.
# Given ``Model`` that has a primary key (``pk``) column that can be
# strings:
mydict =... | {
"repo_name": "disqus/durabledict",
"path": "durabledict/models.py",
"copies": "1",
"size": "6962",
"license": "apache-2.0",
"hash": 4357356640368237000,
"line_mean": 40.4404761905,
"line_max": 80,
"alpha_frac": 0.6131858661,
"autogenerated": false,
"ratio": 4.186410102224895,
"config_test": fa... |
from durabledict.encoding import (
DefaultEncoding,
EncodingError,
)
class DurableDict(object):
"""
Dictionary that calls out to its persistant data store when items are
created or deleted. Syncs with data fron the data store before every read,
unless ``autosync=False`` is passed, which cause... | {
"repo_name": "disqus/durabledict",
"path": "durabledict/base.py",
"copies": "1",
"size": "4233",
"license": "apache-2.0",
"hash": -7558035218750201000,
"line_mean": 28.8098591549,
"line_max": 87,
"alpha_frac": 0.6137491141,
"autogenerated": false,
"ratio": 4.105722599418041,
"config_test": fal... |
from durable.lang import *
import datetime
import random
import sys
with statechart('fraud0'):
with state('start'):
to('standby')
with state('standby'):
@to('metering')
@when_all(m.amount > 100)
def start_metering(c):
c.start_timer('velocity', 30)
with state('m... | {
"repo_name": "jofomah/rules",
"path": "testpy/testsimple.py",
"copies": "1",
"size": "15869",
"license": "mit",
"hash": 8992671898259242000,
"line_mean": 34.0309050773,
"line_max": 96,
"alpha_frac": 0.497762934,
"autogenerated": false,
"ratio": 3.045873320537428,
"config_test": false,
"has_n... |
from durable.lang import *
import math
import datetime
import json
_fact_count = 0
def create_and_post(fact):
global _fact_count
fact['id'] = _fact_count
fact['sid'] = 1
post('waltzdb', fact)
_fact_count += 1
def create_and_assert(fact):
global _fact_count
fact['id'] = _fact_count
fact... | {
"repo_name": "jruizgit/rules",
"path": "testpy/waltzdb.py",
"copies": "1",
"size": "44448",
"license": "mit",
"hash": 6470961334251408000,
"line_mean": 52.8111380145,
"line_max": 144,
"alpha_frac": 0.5165361771,
"autogenerated": false,
"ratio": 2.3534893571958064,
"config_test": false,
"has_... |
from durable.lang import *
import math
import datetime
import json
_fact_count = 0
def create_and_post(host, fact):
global _fact_count
fact['id'] = _fact_count
fact['sid'] = 1
host.post('waltzdb', fact)
_fact_count += 1
def create_and_assert(host, fact):
global _fact_count
fact['id'] = _fa... | {
"repo_name": "jofomah/rules",
"path": "testpy/waltzdb2.py",
"copies": "1",
"size": "51881",
"license": "mit",
"hash": 5600894835813782000,
"line_mean": 59.7505854801,
"line_max": 156,
"alpha_frac": 0.4945741215,
"autogenerated": false,
"ratio": 2.4502219703409844,
"config_test": false,
"has_... |
from durable.lang import *
import random
import time
import json
with ruleset('fraud_detection'):
@when_all(span(10),
(m.t == 'debit_cleared') | (m.t == 'credit_cleared'))
def handle_balance(c):
debit_total = 0
credit_total = 0
if c.s.balance == None:
c.s.balanc... | {
"repo_name": "jofomah/rules",
"path": "testpy/fraud.py",
"copies": "1",
"size": "2890",
"license": "mit",
"hash": 4569572407031186400,
"line_mean": 38.0675675676,
"line_max": 137,
"alpha_frac": 0.4965397924,
"autogenerated": false,
"ratio": 3.0777422790202342,
"config_test": false,
"has_no_k... |
from durable.lang import *
import redis
import time
import datetime
import traceback
import sys
def unix_time(dt):
epoch = datetime.datetime.utcfromtimestamp(0)
delta = dt - epoch
return int(delta.total_seconds() * 1000.0)
def provide_durability(host, redis_host_name = 'localhost', port = 6379):
r = r... | {
"repo_name": "jruizgit/rules",
"path": "testpy/testdurable.py",
"copies": "1",
"size": "3915",
"license": "mit",
"hash": -561716348567861600,
"line_mean": 29.59375,
"line_max": 107,
"alpha_frac": 0.5798212005,
"autogenerated": false,
"ratio": 3.4769094138543517,
"config_test": false,
"has_no... |
from duralex.AbstractVisitor import AbstractVisitor
from duralex.alinea_parser import *
import duralex.tree
class ForkEditVisitor(AbstractVisitor):
def visit_node(self, node):
if 'type' in node and node['type'] == 'edit' and 'children' in node and len(node['children']) > 1:
ref_nodes = [n for... | {
"repo_name": "Legilibre/duralex",
"path": "duralex/ForkEditVisitor.py",
"copies": "1",
"size": "1312",
"license": "mit",
"hash": -6284344222515084000,
"line_mean": 42.7333333333,
"line_max": 106,
"alpha_frac": 0.5213414634,
"autogenerated": false,
"ratio": 3.9047619047619047,
"config_test": fa... |
from duralex.alinea_parser import *
from duralex.AbstractVisitor import AbstractVisitor
class ResolveFullyQualifiedReferencesVisitor(AbstractVisitor):
def __init__(self):
self.ctx = []
super(ResolveFullyQualifiedReferencesVisitor, self).__init__()
def visit_node(self, node):
if not se... | {
"repo_name": "Legilibre/duralex",
"path": "duralex/ResolveFullyQualifiedReferencesVisitor.py",
"copies": "1",
"size": "2803",
"license": "mit",
"hash": -1526336690947973000,
"line_mean": 49.9636363636,
"line_max": 135,
"alpha_frac": 0.5790224759,
"autogenerated": false,
"ratio": 3.65449804432855... |
from duralex.alinea_parser import *
from duralex.AbstractVisitor import AbstractVisitor
import duralex.tree
class ResolveFullyQualifiedDefinitionsVisitor(AbstractVisitor):
def visit_node(self, node):
self.resolve_fully_qualified_definitions(node)
super(ResolveFullyQualifiedDefinitionsVisitor, sel... | {
"repo_name": "Legilibre/duralex",
"path": "duralex/ResolveFullyQualifiedDefinitionsVisitor.py",
"copies": "1",
"size": "2142",
"license": "mit",
"hash": -8338106917938992000,
"line_mean": 50,
"line_max": 127,
"alpha_frac": 0.5499533147,
"autogenerated": false,
"ratio": 4.453222453222454,
"conf... |
from duralex.alinea_parser import *
from duralex.AbstractVisitor import AbstractVisitor
import duralex.tree
class SortReferencesVisitor(AbstractVisitor):
def visit_node(self, node):
if not self.sort_references(node):
super(SortReferencesVisitor, self).visit_node(node)
def sort_references... | {
"repo_name": "Legilibre/duralex",
"path": "duralex/SortReferencesVisitor.py",
"copies": "1",
"size": "1573",
"license": "mit",
"hash": 6381083080796310000,
"line_mean": 40.3947368421,
"line_max": 145,
"alpha_frac": 0.5638906548,
"autogenerated": false,
"ratio": 3.9423558897243107,
"config_test... |
from durations.scales import Scale
from durations.exceptions import ScaleFormatError
from durations.constants import *
from durations.exceptions import (
ScaleFormatError,
InvalidTokenError
)
def valid_token(token):
"""Asserts a provided string is a valid duration token representation
:param token: ... | {
"repo_name": "oleiade/durations",
"path": "durations/parser.py",
"copies": "1",
"size": "2693",
"license": "mit",
"hash": 6347286849568012000,
"line_mean": 27.9569892473,
"line_max": 86,
"alpha_frac": 0.6004455997,
"autogenerated": false,
"ratio": 4.749559082892416,
"config_test": false,
"ha... |
from dustmaker import *
import random
""" Transforms water tiles on layer 19 with a water tile on layer 14 behind them
into an up zip.
"""
f0 = "/home/msg555/Dustforce/content/levels2/downhill"
f1 = "/home/msg555/.HitboxTeam/Dustforce/user/level_src/test"
with open(f0, "rb") as f:
map = read_map(f.read())
de... | {
"repo_name": "msg555/dustmaker",
"path": "examples/zipme.py",
"copies": "1",
"size": "1338",
"license": "apache-2.0",
"hash": -4892429359217103000,
"line_mean": 30.8571428571,
"line_max": 80,
"alpha_frac": 0.6449925262,
"autogenerated": false,
"ratio": 2.9536423841059603,
"config_test": false,... |
from dusty.schemas.base_schema_class import DustySchema
from dusty.schemas.app_schema import app_schema
from dusty.schemas.lib_schema import lib_schema
from dusty.schemas.bundle_schema import bundle_schema
def get_app_dusty_schema(doc, name=None):
if 'image' not in doc and 'build' not in doc:
doc['image'] ... | {
"repo_name": "gamechanger/dusty",
"path": "tests/unit/utils.py",
"copies": "1",
"size": "1385",
"license": "mit",
"hash": -2201182064367650800,
"line_mean": 36.4324324324,
"line_max": 66,
"alpha_frac": 0.6166064982,
"autogenerated": false,
"ratio": 3.1123595505617976,
"config_test": false,
"... |
from dv_apps.datasets.models import Dataset, DatasetVersion
from dv_apps.datasetfields.models import DatasetField, DatasetFieldValue, DatasetFieldType
def get_dataset_title(dataset_version):
"""
Traverse the dataset metadata to retrieve a dataset title
success: (True, title)
fail: (False, error mes... | {
"repo_name": "IQSS/miniverse",
"path": "dv_apps/datasetfields/utils.py",
"copies": "1",
"size": "1820",
"license": "mit",
"hash": 165960615622764930,
"line_mean": 36.9166666667,
"line_max": 102,
"alpha_frac": 0.5961538462,
"autogenerated": false,
"ratio": 4.252336448598131,
"config_test": fals... |
from dv_apps.metrics.stats_view_base import StatsViewSwagger
from dv_apps.metrics.stats_result import StatsResult
from dv_apps.dataverses.models import Dataverse
from dv_apps.dataverses.serializer import DataverseSerializer
#from dv_apps.metrics.stats_util_datasets import StatsMakerDatasets
# limit the API rates
#from... | {
"repo_name": "IQSS/miniverse",
"path": "dv_apps/dvobject_api/api_view_dataverses.py",
"copies": "1",
"size": "3462",
"license": "mit",
"hash": -2513658743719832000,
"line_mean": 40.7108433735,
"line_max": 103,
"alpha_frac": 0.6750433276,
"autogenerated": false,
"ratio": 3.8423973362930077,
"co... |
from dv_apps.metrics.stats_view_base import StatsViewSwagger, StatsViewSwaggerKeyRequired
from dv_apps.metrics.stats_util_datasets_bins import StatsMakerDatasetBins
from dv_apps.metrics.stats_util_dataset_size import StatsMakerDatasetSizes
# limit the API rates
#from ratelimit.decorators import ratelimit
class Files... | {
"repo_name": "IQSS/miniverse",
"path": "dv_apps/metrics/stats_views_dataset_bins.py",
"copies": "1",
"size": "4119",
"license": "mit",
"hash": -4407419851303074000,
"line_mean": 45.2808988764,
"line_max": 102,
"alpha_frac": 0.6671522214,
"autogenerated": false,
"ratio": 3.941626794258373,
"con... |
from dv_apps.metrics.stats_view_base import StatsViewSwagger, StatsViewSwaggerKeyRequired
from dv_apps.metrics.stats_util_datasets import StatsMakerDatasets
# limit the API rates
#from ratelimit.decorators import ratelimit
class DatasetTotalCounts(StatsViewSwaggerKeyRequired):
"""API View - Total count of all Da... | {
"repo_name": "IQSS/miniverse",
"path": "dv_apps/metrics/stats_views_datasets.py",
"copies": "1",
"size": "4281",
"license": "mit",
"hash": -800954623477736100,
"line_mean": 38.6388888889,
"line_max": 122,
"alpha_frac": 0.6729736043,
"autogenerated": false,
"ratio": 3.9419889502762433,
"config_... |
from dvc.cli import parse_args
from dvc.command.checkout import CmdCheckout, log_changes
def test_checkout(tmp_dir, dvc, mocker):
cli_args = parse_args(
["checkout", "foo.dvc", "bar.dvc", "--relink", "--with-deps"]
)
assert cli_args.func == CmdCheckout
cmd = cli_args.func(cli_args)
m = mo... | {
"repo_name": "efiop/dvc",
"path": "tests/unit/command/test_checkout.py",
"copies": "1",
"size": "1254",
"license": "apache-2.0",
"hash": -3209019348588354000,
"line_mean": 26.2608695652,
"line_max": 75,
"alpha_frac": 0.5837320574,
"autogenerated": false,
"ratio": 3.1194029850746268,
"config_te... |
from dvc.cli import parse_args
from dvc.command.data_sync import CmdDataFetch, CmdDataPull, CmdDataPush
def test_fetch(mocker):
cli_args = parse_args(
[
"fetch",
"target1",
"target2",
"--jobs",
"2",
"--remote",
"remote",
... | {
"repo_name": "efiop/dvc",
"path": "tests/unit/command/test_data_sync.py",
"copies": "1",
"size": "2740",
"license": "apache-2.0",
"hash": -9041397094428635000,
"line_mean": 21.4590163934,
"line_max": 77,
"alpha_frac": 0.45,
"autogenerated": false,
"ratio": 3.859154929577465,
"config_test": fal... |
from dvc.cli import parse_args
from dvc.command.imp import CmdImport
def test_import(mocker):
cli_args = parse_args(
[
"import",
"repo_url",
"src",
"--out",
"out",
"--file",
"file",
"--rev",
"versio... | {
"repo_name": "efiop/dvc",
"path": "tests/unit/command/test_imp.py",
"copies": "1",
"size": "1483",
"license": "apache-2.0",
"hash": -6088492290847640000,
"line_mean": 19.0405405405,
"line_max": 59,
"alpha_frac": 0.4126770061,
"autogenerated": false,
"ratio": 3.8720626631853787,
"config_test": ... |
from dvc.cli import parse_args
from dvc.command.ls import CmdList
def _test_cli(mocker, *args):
cli_args = parse_args(["list", *args])
assert cli_args.func == CmdList
cmd = cli_args.func(cli_args)
m = mocker.patch("dvc.repo.Repo.ls")
assert cmd.run() == 0
return m
def test_list(mocker):
... | {
"repo_name": "dmpetrov/dataversioncontrol",
"path": "tests/unit/command/ls/test_ls.py",
"copies": "1",
"size": "1305",
"license": "apache-2.0",
"hash": -4378470597928454700,
"line_mean": 23.1666666667,
"line_max": 63,
"alpha_frac": 0.6153256705,
"autogenerated": false,
"ratio": 2.965909090909091... |
from dvc.cli import parse_args
from dvc.command.params import CmdParamsDiff
def test_params_diff(dvc, mocker):
cli_args = parse_args(
[
"params",
"diff",
"HEAD~10",
"HEAD~1",
"--targets",
"target",
"--all",
"--... | {
"repo_name": "efiop/dvc",
"path": "tests/unit/command/test_params.py",
"copies": "1",
"size": "1959",
"license": "apache-2.0",
"hash": -2780103757247781000,
"line_mean": 26.5915492958,
"line_max": 77,
"alpha_frac": 0.5620214395,
"autogenerated": false,
"ratio": 3.2220394736842106,
"config_test... |
from dvc.cli import parse_args
from dvc.command.run import CmdRun
from tests.utils.asserts import called_once_with_subset
def test_run(mocker, dvc):
cli_args = parse_args(
[
"run",
"--name",
"nam",
"--deps",
"deps",
"--outs",
... | {
"repo_name": "efiop/dvc",
"path": "tests/unit/command/test_run.py",
"copies": "1",
"size": "4229",
"license": "apache-2.0",
"hash": -1850994988755367700,
"line_mean": 24.3233532934,
"line_max": 59,
"alpha_frac": 0.4622842279,
"autogenerated": false,
"ratio": 3.8727106227106227,
"config_test": ... |
from dvc.cli import parse_args
from dvc.command.run import CmdRun
def test_run(mocker, dvc):
cli_args = parse_args(
[
"run",
"--name",
"nam",
"--deps",
"deps",
"--outs",
"outs",
"--outs-no-cache",
"... | {
"repo_name": "dmpetrov/dataversioncontrol",
"path": "tests/unit/command/test_run.py",
"copies": "1",
"size": "3038",
"license": "apache-2.0",
"hash": -6132898340049427000,
"line_mean": 24.1074380165,
"line_max": 59,
"alpha_frac": 0.469716919,
"autogenerated": false,
"ratio": 3.75990099009901,
... |
from dvc.cli import parse_args
from dvc.command.update import CmdUpdate
def test_update(dvc, mocker):
cli_args = parse_args(
[
"update",
"target1",
"target2",
"--rev",
"REV",
"--recursive",
"-j",
"8",
]... | {
"repo_name": "efiop/dvc",
"path": "tests/unit/command/test_update.py",
"copies": "1",
"size": "1275",
"license": "apache-2.0",
"hash": 6436040239551009000,
"line_mean": 19.9016393443,
"line_max": 44,
"alpha_frac": 0.4588235294,
"autogenerated": false,
"ratio": 3.674351585014409,
"config_test":... |
from dvc.command.base import CmdBase, DvcLock
from dvc.logger import Logger
from dvc.state_file import StateFile
class CmdLock(CmdBase):
def __init__(self, settings):
super(CmdLock, self).__init__(settings)
def run(self):
with DvcLock(self.is_locker, self.git):
return self.lock_fi... | {
"repo_name": "ophiry/dvc",
"path": "dvc/command/lock.py",
"copies": "1",
"size": "1713",
"license": "apache-2.0",
"hash": -8560820354379582000,
"line_mean": 39.7857142857,
"line_max": 103,
"alpha_frac": 0.5761821366,
"autogenerated": false,
"ratio": 4.13768115942029,
"config_test": false,
"h... |
from dvc.command.base import CmdBaseNoRepo, fix_subparsers
class CmdDaemonBase(CmdBaseNoRepo):
pass
class CmdDaemonUpdater(CmdDaemonBase):
def run(self):
import os
from dvc.repo import Repo
from dvc.config import Config
from dvc.updater import Updater
root_dir = Repo... | {
"repo_name": "dmpetrov/dataversioncontrol",
"path": "dvc/command/daemon.py",
"copies": "1",
"size": "1976",
"license": "apache-2.0",
"hash": 1167578345913725400,
"line_mean": 28.0588235294,
"line_max": 74,
"alpha_frac": 0.6558704453,
"autogenerated": false,
"ratio": 3.547576301615799,
"config_... |
from dvc.command import completion
from dvc.command.base import CmdBaseNoRepo, fix_subparsers
class CmdDaemonBase(CmdBaseNoRepo):
pass
class CmdDaemonUpdater(CmdDaemonBase):
def run(self):
import os
from dvc.config import Config
from dvc.repo import Repo
from dvc.updater imp... | {
"repo_name": "efiop/dvc",
"path": "dvc/command/daemon.py",
"copies": "1",
"size": "2053",
"license": "apache-2.0",
"hash": 3578658861086032000,
"line_mean": 27.5138888889,
"line_max": 74,
"alpha_frac": 0.6566000974,
"autogenerated": false,
"ratio": 3.576655052264808,
"config_test": false,
"h... |
from dvc.command.ls.ls_colors import LsColors
def colorize(ls_colors):
def _colorize(f, spec=""):
fs_path = {
"path": f,
"isexec": "e" in spec,
"isdir": "d" in spec,
"isout": "o" in spec,
}
return ls_colors.format(fs_path)
return _colori... | {
"repo_name": "dmpetrov/dataversioncontrol",
"path": "tests/unit/command/ls/test_ls_colors.py",
"copies": "1",
"size": "1541",
"license": "apache-2.0",
"hash": -6028644948040389000,
"line_mean": 25.5689655172,
"line_max": 79,
"alpha_frac": 0.6054510058,
"autogenerated": false,
"ratio": 2.64776632... |
from dvc.dvcfile import PIPELINE_FILE, PIPELINE_LOCK
from dvc.objects.db import ODBManager
from dvc.system import System
def test_destroy(tmp_dir, dvc, run_copy):
dvc.config["cache"]["type"] = ["symlink"]
dvc.odb = ODBManager(dvc)
tmp_dir.dvc_gen("file", "text")
tmp_dir.dvc_gen({"dir": {"file": "lore... | {
"repo_name": "efiop/dvc",
"path": "tests/func/test_repo.py",
"copies": "1",
"size": "1270",
"license": "apache-2.0",
"hash": -3828643183926661600,
"line_mean": 23.4230769231,
"line_max": 71,
"alpha_frac": 0.5385826772,
"autogenerated": false,
"ratio": 3.1670822942643393,
"config_test": false,
... |
from dvc.exceptions import DvcException
class StageCmdFailedError(DvcException):
def __init__(self, cmd, status=None):
msg = f"failed to run: {cmd}"
if status is not None:
msg += f", exited with {status}"
super().__init__(msg)
class StageFileFormatError(DvcException):
def... | {
"repo_name": "dmpetrov/dataversioncontrol",
"path": "dvc/stage/exceptions.py",
"copies": "1",
"size": "2870",
"license": "apache-2.0",
"hash": 1574168917196268500,
"line_mean": 23.7413793103,
"line_max": 78,
"alpha_frac": 0.5888501742,
"autogenerated": false,
"ratio": 3.7467362924281984,
"conf... |
from dvc.exceptions import PathMissingError
from dvc.path_info import PathInfo
@staticmethod
def ls(
url, path=None, rev=None, recursive=None, outs_only=False,
):
"""Methods for getting files and outputs for the repo.
Args:
url (str): the repo url
path (str, optional): relative path into ... | {
"repo_name": "dmpetrov/dataversioncontrol",
"path": "dvc/repo/ls.py",
"copies": "1",
"size": "2935",
"license": "apache-2.0",
"hash": -4456175420686417000,
"line_mean": 27.7745098039,
"line_max": 77,
"alpha_frac": 0.5206132879,
"autogenerated": false,
"ratio": 4.02054794520548,
"config_test": ... |
from dvc.fs.local import LocalFileSystem
from dvc.utils import file_md5
from dvc.utils.stream import HashedStreamReader
def test_hashed_stream_reader(tmp_dir):
tmp_dir.gen({"foo": "foo"})
foo = tmp_dir / "foo"
with open(foo, "rb") as fobj:
stream_reader = HashedStreamReader(fobj)
assert ... | {
"repo_name": "efiop/dvc",
"path": "tests/unit/utils/test_stream.py",
"copies": "1",
"size": "1394",
"license": "apache-2.0",
"hash": 2086568845397417200,
"line_mean": 28.0416666667,
"line_max": 64,
"alpha_frac": 0.6226685796,
"autogenerated": false,
"ratio": 3.5470737913486006,
"config_test": ... |
from dvc import dagascii
from dvc.env import DVC_PAGER
def test_find_pager_uses_default_pager_when_found(mocker):
mocker.patch("sys.stdout.isatty", return_value=True)
mocker.patch("os.system", return_value=0)
m_make_pager = mocker.patch.object(dagascii, "make_pager")
dagascii.find_pager()
m_make... | {
"repo_name": "dmpetrov/dataversioncontrol",
"path": "tests/unit/test_dagascii.py",
"copies": "1",
"size": "1205",
"license": "apache-2.0",
"hash": 107831237325190240,
"line_mean": 28.3902439024,
"line_max": 74,
"alpha_frac": 0.7178423237,
"autogenerated": false,
"ratio": 3.0739795918367347,
"c... |
from dvc import prompt
from dvc.dvcfile import Dvcfile
from dvc.stage.exceptions import StageCommitError
from . import locked
def _prepare_message(stage, changes):
changed_deps, changed_outs, changed_stage = changes
if changed_deps and changed_outs:
msg = "dependencies {deps} and outputs {outs} of {s... | {
"repo_name": "dmpetrov/dataversioncontrol",
"path": "dvc/repo/commit.py",
"copies": "1",
"size": "1424",
"license": "apache-2.0",
"hash": 1782304744487934000,
"line_mean": 28.6666666667,
"line_max": 75,
"alpha_frac": 0.6271067416,
"autogenerated": false,
"ratio": 3.7375328083989503,
"config_te... |
from dvc import prompt
from . import locked
def _prepare_message(stage, changes):
changed_deps, changed_outs, changed_stage = changes
if changed_deps and changed_outs:
msg = "dependencies {deps} and outputs {outs} of {stage} changed."
elif changed_deps:
msg = "dependencies {deps} of {stag... | {
"repo_name": "efiop/dvc",
"path": "dvc/repo/commit.py",
"copies": "1",
"size": "1860",
"license": "apache-2.0",
"hash": 7220554413865170000,
"line_mean": 26.3529411765,
"line_max": 75,
"alpha_frac": 0.6129032258,
"autogenerated": false,
"ratio": 3.7424547283702214,
"config_test": false,
"has... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.