repo_name stringlengths 7 65 | path stringlengths 5 185 | copies stringlengths 1 4 | size stringlengths 4 6 | content stringlengths 977 990k | license stringclasses 14
values | hash stringlengths 32 32 | line_mean float64 7.18 99.4 | line_max int64 31 999 | alpha_frac float64 0.25 0.95 | ratio float64 1.5 7.84 | autogenerated bool 1
class | config_or_test bool 2
classes | has_no_keywords bool 2
classes | has_few_assignments bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
all-of-us/raw-data-repository | rdr_service/lib_fhir/fhirclient_3_0_0/models/valueset.py | 1 | 21281 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/ValueSet) on 2017-03-22.
# 2017, SMART Health IT.
from . import domainresource
class ValueSet(domainresource.DomainResource):
""" A set of codes drawn from one or more code systems.
... | bsd-3-clause | 9cc227f3dda773b75866cae6260fa981 | 36.866548 | 104 | 0.598468 | 4.594344 | false | false | false | false |
all-of-us/raw-data-repository | rdr_service/dao/metadata_dao.py | 1 | 1239 | from rdr_service.dao.base_dao import BaseDao
from rdr_service.model.metadata import Metadata
WORKBENCH_LAST_SYNC_KEY = 'WORKBENCH_LAST_SYNC'
class MetadataDao(BaseDao):
def __init__(self):
super(MetadataDao, self).__init__(Metadata)
def upsert_with_session(self, session, key, str_value=None, int_val... | bsd-3-clause | 9d8340f71acf52218282b83bd4d4292b | 34.4 | 97 | 0.623083 | 3.5 | false | false | false | false |
all-of-us/raw-data-repository | rdr_service/lib_fhir/fhirclient_3_0_0/models/immunizationrecommendation.py | 1 | 9048 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/ImmunizationRecommendation) on 2017-03-22.
# 2017, SMART Health IT.
from . import domainresource
class ImmunizationRecommendation(domainresource.DomainResource):
""" Guidance or advice rel... | bsd-3-clause | 335e04e5a7c7ea8ee0fa31d491cc5946 | 40.127273 | 125 | 0.655946 | 4.42445 | false | false | false | false |
brython-dev/brython | www/src/Lib/uuid.py | 1 | 27421 | r"""UUID objects (universally unique identifiers) according to RFC 4122.
This module provides immutable UUID objects (class UUID) and the functions
uuid1(), uuid3(), uuid4(), uuid5() for generating version 1, 3, 4, and 5
UUIDs as specified in RFC 4122.
If all you want is a unique ID, you should probably call uuid1() ... | bsd-3-clause | 6e3223b515727de4e09eae6e2340b23f | 36.511628 | 89 | 0.608694 | 3.632883 | false | false | false | false |
brython-dev/brython | www/src/Lib/encodings/cp863.py | 35 | 34950 | """ Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP863.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,errors=... | bsd-3-clause | 268ccec8d3ca57acb23f07db2d84b1c3 | 48.071633 | 97 | 0.590701 | 3.010336 | false | false | false | false |
brython-dev/brython | www/gallery/sudoku.py | 1 | 1701 | # Boris Borcic 2006
# Quick and concise Python 2.5 sudoku solver
#
# Adapted for Brython by Pierre Quentel
# Load pre-computed tables
# Don't use the stdlib module json (much too slow), use Javascript object
# JSON instead
from browser import window
json = window.JSON
src = open('sudoku.json').read()
data = json.pars... | bsd-3-clause | bdb170b167ddbad8ea48ddcecccaaa6b | 27.830508 | 105 | 0.547913 | 2.878173 | false | false | false | false |
brython-dev/brython | www/src/Lib/test/pystone.py | 122 | 7381 | #! /usr/bin/env python3
"""
"PYSTONE" Benchmark Program
Version: Python/1.1 (corresponds to C/1.1 plus 2 Pystone fixes)
Author: Reinhold P. Weicker, CACM Vol 27, No 10, 10/84 pg. 1013.
Translated from ADA to C by Rick Richardson.
Every method to preserve ADA-likeness ... | bsd-3-clause | 0bb30a92208f2332868df4c05f8e1f07 | 26.337037 | 75 | 0.600461 | 3.302461 | false | false | false | false |
brython-dev/brython | www/src/Lib/encodings/cp775.py | 35 | 35173 | """ Python Character Mapping Codec cp775 generated from 'VENDORS/MICSFT/PC/CP775.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,e... | bsd-3-clause | ddbed86ea7ff0bf9cba2b80864682b6e | 48.463415 | 103 | 0.59051 | 3.020438 | false | false | false | false |
brython-dev/brython | www/src/Lib/test/test_importlib/source/test_file_loader.py | 1 | 32559 | from test.test_importlib import abc, util
importlib = util.import_importlib('importlib')
importlib_abc = util.import_importlib('importlib.abc')
machinery = util.import_importlib('importlib.machinery')
importlib_util = util.import_importlib('importlib.util')
import errno
import marshal
import os
import py_compile
impo... | bsd-3-clause | e449c7362a58545a5361784f959b068e | 39.903266 | 93 | 0.56866 | 4.192506 | false | true | false | false |
brython-dev/brython | www/src/Lib/pprint.py | 1 | 24489 | # Author: Fred L. Drake, Jr.
# fdrake@acm.org
#
# This is a simple little module I wrote to make life easier. I didn't
# see anything quite like it in the library, though I may have overlooked
# something. I wrote this when I was trying to read some heavily nested
# tuples with fairly non-desc... | bsd-3-clause | 5dbee4bd5c0dfcb6b84b88553332bad7 | 35.496274 | 98 | 0.535465 | 4.267863 | false | false | false | false |
brython-dev/brython | www/src/Lib/test/___simplified_test_int.py | 16 | 5648 | import sys
L = [
('0', 0),
('1', 1),
('9', 9),
('10', 10),
('99', 99),
('100', 100),
('314', 314),
(' 314', 314),
('314 ', 314),
(' \t\t 314 \t\t ', 314),
(repr(sys.maxsize), sys.maxsize),
(' 1x', ValueError),
... | bsd-3-clause | fa4993c7b896fe019a9c0aab502858fe | 30.377778 | 80 | 0.533286 | 3.70118 | false | true | false | false |
brython-dev/brython | www/src/Lib/test/test_kqueue.py | 6 | 8966 | """
Tests for kqueue wrapper.
"""
import errno
import os
import select
import socket
import time
import unittest
if not hasattr(select, "kqueue"):
raise unittest.SkipTest("test works only on BSD")
class TestKQueue(unittest.TestCase):
def test_create_queue(self):
kq = select.kqueue()
self.asser... | bsd-3-clause | ce08c5894434018b16003e1ce1832d4c | 33.35249 | 96 | 0.564466 | 3.613865 | false | true | false | false |
brython-dev/brython | www/src/Lib/encodings/cp862.py | 35 | 34068 | """ Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP862.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,errors=... | bsd-3-clause | 891643d61591cb4e9108e5ae2156d108 | 46.808023 | 97 | 0.586004 | 2.929825 | false | false | false | false |
brython-dev/brython | www/src/Lib/errno.py | 2 | 3055 | """This module makes available standard errno system symbols.
The value of each symbol is the corresponding integer value,
e.g., on most systems, errno.ENOENT equals the integer 2.
The dictionary errno.errorcode maps numeric codes to symbol names,
e.g., errno.errorcode[2] could be the string 'ENOENT'.
Symbols that a... | bsd-3-clause | 82ae1811eaf5f78affb5c3e8fbfb5a24 | 9.644599 | 71 | 0.728642 | 2.357253 | false | false | false | false |
brython-dev/brython | www/src/Lib/formatter.py | 47 | 15143 | """Generic output formatting.
Formatter objects transform an abstract flow of formatting events into
specific output events on writer objects. Formatters manage several stack
structures to allow various properties of a writer object to be changed and
restored; writers need not be able to handle relative changes nor an... | bsd-3-clause | b2913cf7e72ad9063fb2aca2739ecc1f | 32.502212 | 77 | 0.573995 | 3.906863 | false | false | false | false |
brython-dev/brython | www/src/Lib/encodings/charmap.py | 860 | 2084 | """ Generic Python Character Mapping Codec.
Use this codec directly rather than through the automatic
conversion mechanisms supplied by unicode() and .encode().
Written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
"""#"
import codecs
### Codec APIs
class... | bsd-3-clause | 5e7cead3682a10caf1e6a35379723da5 | 29.202899 | 73 | 0.695777 | 4.323651 | false | false | false | false |
brython-dev/brython | www/gallery/draw.py | 8 | 7522 | from browser import window, document, alert, html
container = document['container'] # Game board
zone = document['zone'] # Zone where cells move
ctx = zone.getContext('2d')
tools = document['tools']
# Window dimensions
width = window.innerWidth
height = window.innerHeight
dim = min(width, height)
if width>height:
... | bsd-3-clause | e822743d1f8012c526145b3688c2228e | 27.60076 | 75 | 0.580697 | 3.362539 | false | false | false | false |
brython-dev/brython | www/src/Lib/socket.py | 1 | 37160 | # Wrapper module for _socket, providing some additional facilities
# implemented in Python.
"""\
This module provides socket operations and some related functions.
On Unix, it supports IP (Internet Protocol) and Unix domain sockets.
On other systems, it only supports IP. Functions specific for a
socket are available a... | bsd-3-clause | 0213a9f53914dfe8e7f469042dbf5864 | 37.467909 | 95 | 0.595533 | 4.142236 | false | false | false | false |
brython-dev/brython | www/src/Lib/email/feedparser.py | 30 | 22780 | # Copyright (C) 2004-2006 Python Software Foundation
# Authors: Baxter, Wouters and Warsaw
# Contact: email-sig@python.org
"""FeedParser - An email feed parser.
The feed parser implements an interface for incrementally parsing an email
message, line by line. This has advantages for certain applications, such as
thos... | bsd-3-clause | da9650719b2f8ca3630e1d3b0e336007 | 41.342007 | 79 | 0.53266 | 4.744845 | false | false | false | false |
brython-dev/brython | www/src/Lib/importlib/util.py | 10 | 11487 | """Utility code for constructing importers, etc."""
from ._abc import Loader
from ._bootstrap import module_from_spec
from ._bootstrap import _resolve_name
from ._bootstrap import spec_from_loader
from ._bootstrap import _find_spec
from ._bootstrap_external import MAGIC_NUMBER
from ._bootstrap_external import _RAW_MAGI... | bsd-3-clause | 1f5f4a1931a1d262cec0d952cfe357ad | 37.036424 | 85 | 0.618961 | 4.49589 | false | false | false | false |
brython-dev/brython | www/src/Lib/getpass.py | 14 | 5990 | """Utilities to get a password and/or the current user name.
getpass(prompt[, stream]) - Prompt for a password, with echo turned off.
getuser() - Get the user name from the environment or password database.
GetPassWarning - This UserWarning is issued when getpass() cannot prevent
echoing of the passw... | bsd-3-clause | a3d905915be3170570204d977b859af7 | 31.378378 | 81 | 0.58581 | 4.321789 | false | false | false | false |
brython-dev/brython | www/src/Lib/html/entities.py | 2 | 75383 | """HTML character entity references."""
__all__ = ['html5', 'name2codepoint', 'codepoint2name', 'entitydefs']
# maps the HTML entity name to the Unicode code point
# from https://html.spec.whatwg.org/multipage/named-characters.html
name2codepoint = {
'AElig': 0x00c6, # latin capital letter AE = latin capital ... | bsd-3-clause | 7c66396250826830c0e8794fa95a9899 | 29.033068 | 110 | 0.501824 | 2.479704 | false | false | false | false |
brython-dev/brython | www/tests/dom.py | 1 | 3367 | from browser import window, document, html, svg
assert window.empty_list() == []
assert window.list1() == [1, 2, 'a', ['b']]
assert window.jsobj().to_dict() == {'a':1}
c = window.subscriptable('abracadabra')
assert len(c) == 11
assert c[2] == 'r'
Foo = window.get_constructor().new
assert Foo().foo == 'hi'
# test dy... | bsd-3-clause | 81f386f25e34c8f9e20f6e81fddd9e5b | 22.227586 | 76 | 0.650431 | 3.027878 | false | false | false | false |
brython-dev/brython | www/src/Lib/test/test_sort.py | 3 | 13917 | from test import support
import random
import unittest
from functools import cmp_to_key
verbose = support.verbose
nerrors = 0
def check(tag, expected, raw, compare=None):
global nerrors
if verbose:
print(" checking", tag)
orig = raw[:] # save input in case of error
if compare:
... | bsd-3-clause | a996ef948de6bafb31dfa59c0bbc9bee | 34.684615 | 88 | 0.507078 | 3.948085 | false | true | false | false |
brython-dev/brython | www/src/Lib/external_import.py | 1 | 3004 | import os
import sys
from browser import doc
import urllib.request
## this module is able to download modules that are external to
## localhost/src
## so we could download from any URL
class ModuleFinder:
def __init__(self, path_entry):
print("external_import here..")
#print(path_entry)
se... | bsd-3-clause | 8dc520df395d313b158e50e67345674b | 33.528736 | 93 | 0.554594 | 4.092643 | false | false | false | false |
brython-dev/brython | www/src/Lib/encodings/mac_cyrillic.py | 35 | 13761 | """ Python Character Mapping Codec mac_cyrillic generated from 'MAPPINGS/VENDORS/APPLE/CYRILLIC.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def de... | bsd-3-clause | 24dd4e47234006975dc25fce6c484d54 | 42.824104 | 118 | 0.53608 | 3.17806 | false | false | false | false |
brython-dev/brython | www/src/Lib/symtable.py | 3 | 10368 | """Interface to the compiler's internal symbol tables"""
import _symtable
from _symtable import (USE, DEF_GLOBAL, DEF_NONLOCAL, DEF_LOCAL, DEF_PARAM,
DEF_IMPORT, DEF_BOUND, DEF_ANNOT, SCOPE_OFF, SCOPE_MASK, FREE,
LOCAL, GLOBAL_IMPLICIT, GLOBAL_EXPLICIT, CELL)
import weakref
__all__ = ["symtable", "SymbolTa... | bsd-3-clause | fd0f139d606a8a94d7817a78b6d5c18f | 30.803681 | 81 | 0.563754 | 4.101266 | false | false | false | false |
brython-dev/brython | www/src/Lib/encodings/cp1140.py | 35 | 13412 | """ Python Character Mapping Codec cp1140 generated from 'python-mappings/CP1140.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input... | bsd-3-clause | 2bac69bb324acaf92e7a5b0d3e868993 | 41.687296 | 103 | 0.506934 | 3.219395 | false | false | false | false |
brython-dev/brython | www/src/Lib/encodings/iso8859_1.py | 35 | 13483 | """ Python Character Mapping Codec iso8859_1 generated from 'MAPPINGS/ISO8859/8859-1.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,i... | bsd-3-clause | e433b7cebabf884e11cacfe2c119de10 | 41.918567 | 107 | 0.504413 | 3.185964 | false | false | false | false |
brython-dev/brython | www/src/Lib/base64.py | 1 | 21028 | #! /usr/bin/env python3
"""Base16, Base32, Base64 (RFC 3548), Base85 and Ascii85 data encodings"""
# Modified 04-Oct-1995 by Jack Jansen to use binascii module
# Modified 30-Dec-2003 by Barry Warsaw to add full RFC 3548 support
# Modified 22-May-2007 by Guido van Rossum to use bytes everywhere
import re
import struc... | bsd-3-clause | aeccc714f5c1ac34410de1ee745b83cb | 33.642504 | 84 | 0.615322 | 3.603153 | false | false | false | false |
brython-dev/brython | www/src/Lib/test/test_multibytecodec.py | 4 | 16134 | #
# test_multibytecodec.py
# Unit test for multibytecodec itself
#
import _multibytecodec
import codecs
import io
import sys
import textwrap
import unittest
from test import support
from test.support import os_helper
from test.support.os_helper import TESTFN
ALL_CJKENCODINGS = [
# _codecs_cn
'gb2312', 'gbk', 'g... | bsd-3-clause | 3c47464e390eceafda9f6d5e648c18ab | 38.45098 | 83 | 0.601764 | 3.567376 | false | true | false | false |
brython-dev/brython | www/src/Lib/test/test_userlist.py | 6 | 2016 | # Check every path through every method of UserList
from collections import UserList
from test import list_tests
import unittest
class UserListTest(list_tests.CommonTest):
type2test = UserList
def test_getslice(self):
super().test_getslice()
l = [0, 1, 2, 3, 4]
u = self.type2test(l)
... | bsd-3-clause | 76163bb5cbf0622507518441ced39cd8 | 28.217391 | 72 | 0.528274 | 3.288744 | false | true | false | false |
brython-dev/brython | www/gallery/raphael/picker.py | 2 | 1553 | import math
from browser import document, window
Raphael = window.Raphael
out = document["output"]
vr = document["vr"]
vg = document["vg"]
vb = document["vb"]
vh = document["vh"]
vh2 = document["vh2"]
vs = document["vs"]
vs2 = document["vs2"]
vv = document["vv"]
vl = document["vl"]
def update_color(ev, cp, cp2):
... | bsd-3-clause | 6000e8509caa550c7bd435ce2c829101 | 24.016129 | 75 | 0.567376 | 2.669535 | false | false | false | false |
brython-dev/brython | www/src/Lib/signal.py | 14 | 2438 | import _signal
from _signal import *
from enum import IntEnum as _IntEnum
_globals = globals()
_IntEnum._convert_(
'Signals', __name__,
lambda name:
name.isupper()
and (name.startswith('SIG') and not name.startswith('SIG_'))
or name.startswith('CTRL_'))
_IntEnum._c... | bsd-3-clause | 1977448442b3dd8e529a1d2e1d5208d7 | 25.5 | 77 | 0.629204 | 3.458156 | false | false | false | false |
brython-dev/brython | www/src/Lib/copyreg.py | 1 | 7677 | """Helper to provide extensibility for pickle.
This is only useful to add pickle support for extension types defined in
C, not for instances of user-defined classes.
"""
__all__ = ["pickle", "constructor",
"add_extension", "remove_extension", "clear_extension_cache"]
dispatch_table = {}
def pickle(ob_typ... | bsd-3-clause | 54b32ede3f27c533bf6dac25e5cbed97 | 33.426009 | 77 | 0.590726 | 4.176823 | false | false | false | false |
brython-dev/brython | www/tests/test_fstrings.py | 1 | 1843 | from tester import assertRaises
try:
"{:+3}".format('essai')
except ValueError:
pass
x = f'{"""a}c"""[1]}'
"""ab
cd"""
assert x == "}"
d = {0: 'zero'}
assert f"""{d[0
]}""" == "zero"
assert f'{"quoted string"}' == "quoted string"
assert f'{{ {4*10} }}' == "{ 40 }"
assert f'{{{4*10}}}' == "{40}"
x = 25.487... | bsd-3-clause | e6483291e006a061b79df8141f66ca27 | 15.175439 | 63 | 0.501356 | 2.412304 | false | false | false | false |
brython-dev/brython | www/src/Lib/encodings/cp861.py | 35 | 35331 | """ Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP861.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,errors=... | bsd-3-clause | 49bb36e89e5d170f2200185221b81436 | 48.617479 | 97 | 0.592737 | 3.019744 | false | false | false | false |
brython-dev/brython | www/src/Lib/multiprocessing/pool.py | 694 | 23263 | #
# Module providing the `Pool` class for managing a process pool
#
# multiprocessing/pool.py
#
# Copyright (c) 2006-2008, R Oudkerk
# Licensed to PSF under a Contributor Agreement.
#
__all__ = ['Pool']
#
# Imports
#
import threading
import queue
import itertools
import collections
import time
from multiprocessing ... | bsd-3-clause | 1f82e950a32e3e1bc48bcd6644b2e262 | 30.867123 | 83 | 0.543438 | 4.425147 | false | false | false | false |
brython-dev/brython | www/src/Lib/pathlib.py | 1 | 48572 | import fnmatch
import functools
import io
import ntpath
import os
import posixpath
import re
import sys
import warnings
from _collections_abc import Sequence
from errno import ENOENT, ENOTDIR, EBADF, ELOOP
from operator import attrgetter
from stat import S_ISDIR, S_ISLNK, S_ISREG, S_ISSOCK, S_ISBLK, S_ISCHR, S_ISFIFO
f... | bsd-3-clause | 6b067c9a97d3113e9bc1debd70785a70 | 33.54623 | 110 | 0.558738 | 4.181474 | false | false | false | false |
brython-dev/brython | www/src/Lib/test/test_enumerate.py | 3 | 9356 | import unittest
import operator
import sys
import pickle
import gc
from test import support
class G:
'Sequence using __getitem__'
def __init__(self, seqn):
self.seqn = seqn
def __getitem__(self, i):
return self.seqn[i]
class I:
'Sequence using iterator protocol'
def __init__(self,... | bsd-3-clause | aa58cbe040a506ee38fe826364e09e1e | 30.608108 | 86 | 0.573856 | 3.831286 | false | true | false | false |
brython-dev/brython | www/src/Lib/encodings/cp1006.py | 35 | 13875 | """ Python Character Mapping Codec cp1006 generated from 'MAPPINGS/VENDORS/MISC/CP1006.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self... | bsd-3-clause | bec8f31e4cd97ea31736b2ef0dd28dd6 | 43.19544 | 109 | 0.529946 | 3.094335 | false | false | false | false |
brython-dev/brython | www/src/Lib/encodings/iso8859_8.py | 35 | 11343 | """ Python Character Mapping Codec iso8859_8 generated from 'MAPPINGS/ISO8859/8859-8.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,i... | bsd-3-clause | 771e83aeba9cdaec7da4a4a57573d141 | 34.947883 | 107 | 0.47677 | 3.032888 | false | false | false | false |
brython-dev/brython | www/src/Lib/test/test_copy.py | 1 | 27028 | """Unit tests for the copy module."""
import copy
import copyreg
import weakref
import abc
from operator import le, lt, ge, gt, eq, ne
import unittest
from test import support
order_comparisons = le, lt, ge, gt
equality_comparisons = eq, ne
comparisons = order_comparisons + equality_comparisons
class TestCopy(unitt... | bsd-3-clause | a3055748b0d3bdfca437b5e5fb4c6f4f | 28.93134 | 76 | 0.488863 | 3.657375 | false | true | false | false |
brython-dev/brython | www/src/Lib/encodings/cp720.py | 35 | 13995 | """Python Character Mapping Codec cp720 generated on Windows:
Vista 6.0.6002 SP2 Multiprocessor Free with the command:
python Tools/unicode/genwincodec.py 720
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encod... | bsd-3-clause | d3d44a20db0c119e911431142bf92aa0 | 43.291262 | 77 | 0.526902 | 3.265282 | false | false | false | false |
brython-dev/brython | www/src/Lib/test/test__osx_support.py | 3 | 13947 | """
Test suite for _osx_support: shared OS X support functions.
"""
import os
import platform
import stat
import sys
import unittest
from test.support import os_helper
import _osx_support
@unittest.skipUnless(sys.platform.startswith("darwin"), "requires OS X")
class Test_OSXSupport(unittest.TestCase):
def setU... | bsd-3-clause | 6e7045c2b326dc53cabcca033c584d3c | 41.782209 | 81 | 0.533663 | 3.325465 | false | true | false | false |
brython-dev/brython | www/src/Lib/itertools.py | 10 | 15909 | import operator
class accumulate:
def __init__(self, iterable, func = operator.add):
self.it = iter(iterable)
self._total = None
self.func = func
def __iter__(self):
return self
def __next__(self):
if not self._total:
self._total = next(self.it)... | bsd-3-clause | 77184593e8361758ae2e12285ba1b7cd | 30.50297 | 87 | 0.533534 | 3.858598 | false | false | false | false |
brython-dev/brython | www/benchmarks/performance/bm_nbody.py | 18 | 4440 | #!/usr/bin/env python
"""N-body benchmark from the Computer Language Benchmarks Game.
This is intended to support Unladen Swallow's perf.py. Accordingly, it has been
modified from the Shootout version:
- Accept standard Unladen Swallow benchmark options.
- Run report_energy()/advance() in a loop.
This currently requ... | bsd-3-clause | 7f74ed9e70bb90d37de0538f7981e434 | 29.62069 | 94 | 0.543694 | 2.676311 | false | false | false | false |
brython-dev/brython | www/gallery/highcharts/examples/3d-column-interactive/chart.py | 5 | 1245 | from browser import document, window
b_highchart = window.Highcharts.Chart.new
chart = b_highchart({
'chart': {
'renderTo': 'container',
'type': 'column',
'margin': 75,
'options3d': {
'enabled': True,
'alpha': 15,
'beta': 15,
'depth':... | bsd-3-clause | 612e4db1b61b14369aabaae6fe9bd837 | 22.961538 | 96 | 0.559839 | 3.242188 | false | false | false | false |
brython-dev/brython | www/src/Lib/logging/__init__.py | 1 | 78286 | # Copyright 2001-2019 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this permissio... | bsd-3-clause | 079033d961490a749d964825084869b4 | 34.455616 | 106 | 0.58041 | 4.485019 | false | false | false | false |
brython-dev/brython | www/src/Lib/encodings/cp852.py | 35 | 35700 | """ Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP852.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,errors=... | bsd-3-clause | 1541ebd24e4d57584199ee6d452b0f67 | 49.146132 | 97 | 0.593529 | 3.047896 | false | false | false | false |
dimagi/commcare-hq | corehq/messaging/whatsapputil.py | 1 | 2142 | import re
from collections import namedtuple
from corehq.apps.domain.models import Domain
from dimagi.utils.web import get_url_base
WA_TEMPLATE_STRING = "cc_wa_template"
class WhatsAppTemplateStringException(Exception):
pass
def is_whatsapp_template_message(message_text):
return WA_TEMPLATE_STRING in messa... | bsd-3-clause | 5dab5e72e33397712b4c90551c5df51e | 35.931034 | 105 | 0.673203 | 3.534653 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/reports/filters/urls.py | 1 | 1090 | from django.conf.urls import re_path as url
from .api import (
CaseListFilterOptions,
DeviceLogIds,
DeviceLogUsers,
EmwfOptionsView,
MobileWorkersOptionsView,
ReassignCaseOptions,
EnterpriseUserOptions,
)
from .location import LocationGroupFilterOptions
urlpatterns = [
url(r'^emwf_opti... | bsd-3-clause | 7b45b08d0ba036e155bf9aed525c399f | 44.416667 | 105 | 0.723853 | 3.516129 | false | false | true | false |
onepercentclub/bluebottle | bluebottle/statistics/migrations/0009_auto_20200717_1201.py | 1 | 1315 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2020-07-17 10:01
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('statistics', '0008_auto_20200717_1136'),
]
operations = [
migrations.Alter... | bsd-3-clause | 30e03608a2f6bb83c4df35366ddd6894 | 64.75 | 900 | 0.670722 | 3.563686 | false | false | false | false |
dimagi/commcare-hq | fabfile.py | 1 | 2336 | import os
import time
print()
print("Hey things have changed.")
print()
time.sleep(1)
print("We now do deploys from the commcare-cloud directory or the control machine.")
print()
time.sleep(2)
if 'y' == input('Do you want instructions for how to migrate? [y/N]'):
print()
for dir_name in ['commcarehq-ansible', ... | bsd-3-clause | ce9ba650e7725d211df75846d7566f8d | 25.827586 | 97 | 0.607969 | 4.031088 | false | false | false | false |
dimagi/commcare-hq | corehq/ex-submodules/pillowtop/reindexer/change_providers/form.py | 1 | 1748 | from corehq.form_processor.change_publishers import change_meta_from_sql_form
from corehq.form_processor.models import XFormInstance
from corehq.util.pagination import paginate_function, ArgsListProvider
from pillowtop.feed.interface import Change
from pillowtop.reindexer.change_providers.interface import ChangeProvide... | bsd-3-clause | 5e0c2b538ffa2d2d81d69fe9fa326169 | 33.96 | 77 | 0.616133 | 4.055684 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/userreports/reports/sum_when_templates.py | 1 | 7827 | import re
from dimagi.ext.jsonobject import (
IntegerProperty,
JsonObject,
ListProperty,
StringProperty,
)
from corehq.apps.userreports.specs import TypeProperty
class SumWhenTemplateSpec(JsonObject):
type = StringProperty(required=True)
expression = StringProperty(required=True)
binds =... | bsd-3-clause | a2e4f353f02d19ca0287b5d2ea32ecfb | 34.739726 | 206 | 0.734125 | 3.334896 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/export/det/schema_generator.py | 1 | 8151 | from django.utils.translation import gettext_lazy as _
from corehq.apps.data_dictionary.models import CaseProperty
from corehq.apps.export.det.base import DETRow, DETTable, DETConfig
from corehq.apps.export.det.exceptions import DETConfigError
from corehq.apps.export.models import FormExportInstance, CaseExportInstanc... | bsd-3-clause | d358a5c63d20eba4351e5f6663d8c82c | 34.75 | 105 | 0.658815 | 3.559389 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/export/filters.py | 1 | 5503 | from corehq.apps.es import filters as esfilters
from corehq.apps.es.cases import (
closed_range,
is_closed,
modified_range,
opened_by,
opened_range,
owner,
owner_type,
user, server_modified_range,
)
from corehq.apps.es.forms import app, submitted, user_id, user_type
from corehq.apps.es.s... | bsd-3-clause | 951c6d2cb71dee5af4eede8fe193c6aa | 21.834025 | 102 | 0.654189 | 3.456658 | false | false | false | false |
onepercentclub/bluebottle | bluebottle/members/tests/test_unit.py | 1 | 6456 | import datetime
from datetime import timedelta
from unittest import mock
from django.contrib.auth.password_validation import get_default_password_validators
from django.utils.timezone import now
from pytz import UTC
from bluebottle.clients.models import Client
from bluebottle.clients.utils import LocalTenant
from blu... | bsd-3-clause | 3cd9189d9c091512db33a12010661947 | 29.309859 | 85 | 0.615242 | 4.227898 | false | true | false | false |
onepercentclub/bluebottle | bluebottle/funding/migrations/0003_auto_20190604_1459.py | 1 | 1369 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2019-06-04 12:59
from __future__ import unicode_literals
import bluebottle.utils.fields
from decimal import Decimal
from django.db import migrations
import djmoney.models.fields
class Migration(migrations.Migration):
dependencies = [
('funding', '... | bsd-3-clause | 65c56168c9f546a130b7baa506357831 | 35.026316 | 149 | 0.611395 | 3.792244 | false | false | false | false |
dimagi/commcare-hq | corehq/util/workbook_json/excel.py | 1 | 10173 | import io
from zipfile import BadZipfile
from tempfile import NamedTemporaryFile
import openpyxl
from openpyxl.utils.exceptions import InvalidFileException
from django.core.files.uploadedfile import UploadedFile
from django.utils.translation import gettext as _
class InvalidExcelFileException(Exception):
pass
c... | bsd-3-clause | d30bdd75511f6fef8c5de4cace4b3438 | 29.734139 | 108 | 0.539172 | 4.229938 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/notifications/forms.py | 1 | 3004 | from django import forms
from django.contrib.postgres.forms import SimpleArrayField
from django.urls import reverse
from django.utils.translation import gettext as _
from django.utils.translation import gettext_lazy
from crispy_forms import bootstrap as twbscrispy
from crispy_forms import layout as crispy
from crispy_... | bsd-3-clause | 14fd3f9adc06c215dc685a9a88e420af | 34.341176 | 96 | 0.581225 | 4.303725 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/case_search/filter_dsl.py | 1 | 9437 | import re
from dataclasses import dataclass
from django.utils.translation import gettext as _
from eulxml.xpath import parse as parse_xpath
from eulxml.xpath.ast import (
BinaryExpression,
FunctionCall,
Step,
UnaryExpression,
serialize,
)
from corehq.apps.case_search.dsl_utils import unwrap_value... | bsd-3-clause | caac651b5d33d7e1d27cae2e9e059e6f | 35.719844 | 114 | 0.611317 | 4.005518 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/export/tests/test_export_item.py | 1 | 2922 | from collections import namedtuple
from django.test import SimpleTestCase
from unittest import mock
from corehq.apps.export.models import (
ExportColumn,
ExportItem,
MultipleChoiceItem,
Option,
)
from corehq.apps.export.models.new import MAIN_TABLE, PathNode
MockRequest = namedtuple('MockRequest', '... | bsd-3-clause | 9f91845ce9e8fe5cc092d0abd0c0ddd4 | 35.525 | 107 | 0.659138 | 3.666248 | false | true | false | false |
dimagi/commcare-hq | corehq/apps/userreports/management/commands/delete_orphaned_ucrs.py | 1 | 8076 | from collections import defaultdict
from textwrap import dedent
from django.core.management.base import BaseCommand
from sqlalchemy.exc import ProgrammingError
from corehq.apps.domain.models import Domain
from corehq.apps.userreports.models import (
DataSourceConfiguration,
StaticDataSourceConfiguration,
)
f... | bsd-3-clause | b9c7349e4455c33db778ffda42f34921 | 35.542986 | 111 | 0.629148 | 3.93184 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/callcenter/queries.py | 1 | 8169 | from abc import ABCMeta, abstractmethod, abstractproperty
from memoized import memoized
from sqlalchemy import distinct, func
from sqlalchemy.sql import and_, label, operators, or_, select
from corehq.apps.callcenter.const import *
class BaseQuery(metaclass=ABCMeta):
@abstractproperty
def sql_adapter(self)... | bsd-3-clause | b0a48c1829317209f001d95332279050 | 30.910156 | 100 | 0.615375 | 3.603441 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/app_manager/const.py | 1 | 2707 | APP_V1 = '1.0'
APP_V2 = '2.0'
MAJOR_RELEASE_TO_VERSION = {
"1": APP_V1,
"2": APP_V2,
}
SCHEDULE_PHASE = 'current_schedule_phase'
SCHEDULE_LAST_VISIT = 'last_visit_number_{}'
SCHEDULE_LAST_VISIT_DATE = 'last_visit_date_{}'
SCHEDULE_GLOBAL_NEXT_VISIT_DATE = 'next_visit_date'
SCHEDULE_NEXT_DUE = 'next_due'
SCHEDU... | bsd-3-clause | 679267b7d7a08e02c6067c141217f5cd | 27.494737 | 95 | 0.715922 | 2.688183 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/reports/management/commands/project_stats_report.py | 1 | 24286 | from collections import defaultdict
from datetime import date, datetime
from django.core.management import BaseCommand
from django.db import ProgrammingError, connections, models, router
from django.db.models import Count, F, Func
from django.db.models.aggregates import Avg, StdDev
from dateutil.relativedelta import ... | bsd-3-clause | 0908408f6927eb946aeac96cd0196122 | 37.065831 | 111 | 0.601169 | 3.819755 | false | false | false | false |
onepercentclub/bluebottle | bluebottle/deeds/serializers.py | 1 | 5678 | from rest_framework import serializers
from rest_framework.validators import UniqueTogetherValidator
from rest_framework_json_api.relations import (
ResourceRelatedField,
SerializerMethodResourceRelatedField, SerializerMethodHyperlinkedRelatedField
)
from bluebottle.activities.utils import (
BaseActivitySe... | bsd-3-clause | f88e80ff2428b643192bcd840cc7482f | 34.267081 | 95 | 0.686862 | 4.391338 | false | false | false | false |
dimagi/commcare-hq | corehq/feature_previews.py | 1 | 7272 | """
Feature Previews are built on top of toggle, so if you migrate a toggle to
a feature preview, you shouldn't need to migrate the data, as long as the
slug is kept intact.
"""
from django.conf import settings
from django.utils.translation import gettext_lazy as _
from django_prbac.utils import has_privilege as prbac_... | bsd-3-clause | e8d19c4e748897b75da08db66c37b530 | 33.140845 | 118 | 0.693619 | 3.7875 | false | false | false | false |
dimagi/commcare-hq | custom/inddex/reports/r3_nutrient_intake.py | 1 | 4614 | import textwrap
from itertools import chain
from corehq.apps.reports.filters.case_list import CaseListFilter
from custom.inddex import filters
from custom.inddex.food import FoodData
from .utils import MultiTabularReport, format_row, na_for_None
class NutrientIntakeReport(MultiTabularReport):
name = 'Report 3 -... | bsd-3-clause | 6ede8447f856743a584d0d853870dff6 | 33.954545 | 110 | 0.614434 | 3.538344 | false | false | false | false |
onepercentclub/bluebottle | bluebottle/looker/utils.py | 1 | 3409 | from future import standard_library
from bluebottle.members.models import MemberPlatformSettings
standard_library.install_aliases()
from builtins import object
import binascii
from collections import OrderedDict
import json
import hmac
import base64
from hashlib import sha1
import time
import os
from urllib.parse imp... | bsd-3-clause | fbd638db5bbdb5434cacb17eaac106e1 | 32.097087 | 98 | 0.605456 | 4.03432 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/cloudcare/touchforms_api.py | 1 | 4048 | from corehq.apps.app_manager.suite_xml.sections.entries import EntriesHelper
from corehq.apps.cloudcare import CLOUDCARE_DEVICE_ID
from corehq.apps.users.models import CouchUser
from corehq.form_processor.models import CommCareCase
DELEGATION_STUB_CASE_TYPE = "cc_delegation_stub"
class BaseSessionDataHelper(object):... | bsd-3-clause | 2f3ec64dee22129f36f7c74d4d9ecead | 35.142857 | 103 | 0.620059 | 3.572816 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/reports/tests/test_supply_accessors.py | 1 | 4004 | import uuid
from django.test import TestCase
from casexml.apps.case.mock import CaseFactory
from corehq.apps.commtrack.helpers import make_product
from corehq.apps.hqcase.utils import submit_case_blocks
from corehq.apps.reports.analytics.dbaccessors import (
get_aggregated_ledger_values,
)
from corehq.form_proce... | bsd-3-clause | 40b10ca54b3b345f13e51d06e05b1eec | 36.773585 | 91 | 0.636613 | 3.42515 | false | true | false | false |
onepercentclub/bluebottle | bluebottle/collect/serializers.py | 1 | 7318 | from rest_framework import serializers
from rest_framework.serializers import ModelSerializer
from rest_framework_json_api.relations import (
ResourceRelatedField,
SerializerMethodResourceRelatedField, SerializerMethodHyperlinkedRelatedField
)
from bluebottle.activities.utils import (
BaseActivitySerialize... | bsd-3-clause | 125da27cd0a4f22d36e14dff6213c4b3 | 33.682464 | 98 | 0.674638 | 4.605412 | false | false | false | false |
onepercentclub/bluebottle | bluebottle/test/factory_models/geo.py | 1 | 2010 | from builtins import object
import factory
from django.contrib.gis.geos import Point
from bluebottle.geo.models import (
Country, SubRegion, Region, Location, LocationGroup, Place,
Geolocation)
class RegionFactory(factory.DjangoModelFactory):
class Meta(object):
model = Region
name = factor... | bsd-3-clause | 18014779f4480bce6ec3f5a2dfaa59e0 | 26.162162 | 68 | 0.694527 | 3.918129 | false | false | false | false |
dimagi/commcare-hq | corehq/form_processor/migrations/0039_auto_20151130_1748.py | 1 | 1284 | from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('form_processor', '0038_form_functions'),
]
operations = [
migrations.CreateModel(
name='LedgerValue',
fields=[
('id', models.AutoField(verbose_name='... | bsd-3-clause | 93a0a4cbe704203dbd9567a9375ad49e | 40.419355 | 233 | 0.566978 | 4.089172 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/es/tests/test_registry.py | 1 | 4626 | from django.test import SimpleTestCase
from ..exceptions import ESRegistryError
from ..registry import (
_ES_INFO_REGISTRY,
_ALIAS_REF_COUNTS,
register,
deregister,
verify_alias,
verify_registered,
registry_entry,
get_registry,
)
from .utils import es_test
class INDEX_INFO:
alias ... | bsd-3-clause | c01bb0c06c28c7affcbef77c01d370b7 | 32.280576 | 78 | 0.615218 | 3.454817 | false | true | false | false |
dimagi/commcare-hq | custom/samveg/case_importer/validators.py | 1 | 8105 | import datetime
import re
from collections import Counter, defaultdict
from django.utils.translation import gettext as _
from corehq.apps.case_importer.util import EXTERNAL_ID
from corehq.apps.domain.models import OperatorCallLimitSettings
from corehq.util.dates import get_previous_month_date_range, iso_string_to_dat... | bsd-3-clause | 8b5d0033828f1bf467043d8fa6f3186c | 34.393013 | 107 | 0.639605 | 4.034345 | false | false | false | false |
onepercentclub/bluebottle | bluebottle/members/migrations/0005_auto_20160830_0902.py | 1 | 1277 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-08-30 07:02
from __future__ import unicode_literals
from django.db import migrations
def add_export_permission(apps, schema_editor):
ContentType = apps.get_model("contenttypes", "ContentType")
Group = apps.get_model("auth", "Group")
Permission =... | bsd-3-clause | bc0e201d78943876a1a816c495f93dfd | 33.513514 | 89 | 0.607674 | 4.373288 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/domain/tests/test_delete_domain.py | 1 | 48691 | import random
import uuid
from contextlib import ExitStack
from datetime import date, datetime, timedelta
from decimal import Decimal
from io import BytesIO
from django.contrib.auth.models import User
from django.core.management import call_command
from django.db.transaction import TransactionManagementError
from djan... | bsd-3-clause | 0d5a50cf316467c812f2a0f26f5f4690 | 40.545222 | 115 | 0.651578 | 3.8201 | false | true | false | false |
dimagi/commcare-hq | corehq/apps/hqcase/management/commands/ptop_preindex.py | 1 | 5839 | # http://www.gevent.org/gevent.monkey.html#module-gevent.monkey
from datetime import datetime
from django.conf import settings
from django.core.mail import mail_admins
from django.core.management.base import BaseCommand
import gevent
from gevent import monkey
from corehq.apps.hqcase.management.commands.ptop_reindexe... | bsd-3-clause | c11dbf496c47932b26a06a25d3afe984 | 35.267081 | 108 | 0.6174 | 3.931987 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/es/forms.py | 1 | 3323 | """
FormES
--------
"""
from django.conf import settings
from corehq.pillows.mappings.const import NULL_VALUE
from . import filters
from .client import ElasticDocumentAdapter, create_document_adapter
from .es_query import HQESQuery
from .transient_util import get_adapter_mapping, from_dict_with_possible_id
class Fo... | bsd-3-clause | 3d59a4fa4576818db595d46979e06ff8 | 24.75969 | 94 | 0.629251 | 3.443523 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/ivr/models.py | 1 | 2975 | from django.db import models
from corehq.apps.sms.mixin import UnrecognizedBackendException
from corehq.apps.sms.models import OUTGOING, Log, SQLMobileBackend
from corehq.util.mixin import UUIDGeneratorMixin
class SQLIVRBackend(SQLMobileBackend):
"""
IVR Functionality has been removed, but this model is bein... | bsd-3-clause | 703d1f93da93b860b8dd4a35464a58f9 | 36.1875 | 83 | 0.715966 | 3.929987 | false | false | false | false |
dimagi/commcare-hq | corehq/motech/repeaters/views/repeaters.py | 1 | 11058 | from collections import namedtuple
from django.contrib import messages
from django.http import Http404, HttpResponseRedirect
from django.urls import reverse
from django.utils.decorators import method_decorator
from django.utils.translation import gettext as _
from django.utils.translation import gettext_lazy
from djan... | bsd-3-clause | fd125ac583cdb9d5351d86599277853c | 32.920245 | 85 | 0.65482 | 3.838251 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/data_interfaces/migrations/0001_initial.py | 1 | 2411 | import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='AutomaticUpdateRule',
fields=[
('id', models.AutoField(verbose_name='ID', seria... | bsd-3-clause | d45ef6cd8f8b971ad7173e0cd7704139 | 44.490566 | 162 | 0.554542 | 4.431985 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/app_manager/tests/test_apps.py | 1 | 14209 | import json
import os
import uuid
from django.test import TestCase
from collections import namedtuple
from memoized import memoized
from unittest.mock import patch
from corehq.apps.app_manager.dbaccessors import get_app, get_build_ids
from corehq.apps.app_manager.models import (
Application,
ApplicationBase,... | bsd-3-clause | 9b87bc381a5a9e4fa3962c7b7205a5cc | 37.501355 | 112 | 0.62793 | 3.530567 | false | true | false | false |
dimagi/commcare-hq | corehq/apps/users/cases.py | 1 | 1370 | import numbers
from couchdbkit import ResourceNotFound
from corehq.apps.groups.models import Group
from corehq.apps.locations.models import SQLLocation
from corehq.apps.users.models import CommCareUser, CouchUser, WebUser
def user_db():
return CouchUser.get_db()
def get_owner_id(case):
return case.owner_i... | bsd-3-clause | df934eb37a3248f2ae9691505db76559 | 23.464286 | 69 | 0.629927 | 3.653333 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/domain/management/commands/delete_domain.py | 1 | 1908 | import textwrap
from django.core.management.base import BaseCommand
from corehq.apps.domain.dbaccessors import iter_all_domains_and_deleted_domains_with_name
class Command(BaseCommand):
help = "Deletes the given domain and its contents"
def add_arguments(self, parser):
parser.add_argument(
... | bsd-3-clause | 0687600940e048a93bbcce17389a5b4c | 37.938776 | 101 | 0.58805 | 4.468384 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/app_manager/tests/test_build_errors.py | 1 | 11081 | import json
import os
from unittest.mock import patch
from django.test import SimpleTestCase
from corehq.apps.app_manager.const import (
REGISTRY_WORKFLOW_LOAD_CASE,
REGISTRY_WORKFLOW_SMART_LINK,
WORKFLOW_MODULE,
)
from corehq.apps.app_manager.models import (
Application,
CaseList,
CaseSearch,... | bsd-3-clause | ffa62e75823ad1d277212163e807d83e | 38.294326 | 114 | 0.578197 | 3.659511 | false | true | false | false |
dimagi/commcare-hq | corehq/ex-submodules/dimagi/test_utils/base.py | 1 | 5633 | from django.conf import settings
from six.moves import range
if not settings.configured:
settings.configure(DEBUG=True)
from unittest.mock import MagicMock, NonCallableMock, patch
from unittest import TestCase
from memoized import memoized
from dimagi.utils.chunked import chunked
from dimagi.utils.read_only imp... | bsd-3-clause | f05ba71a12fc173fcce573cb19056672 | 36.059211 | 107 | 0.566661 | 3.514036 | false | true | false | false |
dimagi/commcare-hq | corehq/apps/zapier/tests/test_fields.py | 1 | 7789 | from django.test.client import Client
from django.test.testcases import SimpleTestCase, TestCase
from tastypie.resources import Resource
from corehq.apps.app_manager.tests.app_factory import AppFactory
from corehq.apps.zapier.api.v0_5 import ZapierCustomFieldCaseResource
from corehq.apps.zapier.util import remove_adv... | bsd-3-clause | eb110e6ef4a3c1212177e87ca6a58628 | 47.68125 | 111 | 0.474515 | 3.696725 | false | true | false | false |
dimagi/commcare-hq | corehq/apps/reports/migrations/0004_tableauserver_tableauvisualization.py | 1 | 1457 | # Generated by Django 2.2.20 on 2021-05-03 17:25
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('reports', '0003_multiselect_report_filters_are_lists'),
]
operations = [
migrations.CreateModel(
... | bsd-3-clause | 0bdc83061d94a7062beb99bcefa7563f | 41.852941 | 152 | 0.59094 | 4.223188 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/fixtures/tests/test_fixture_data.py | 1 | 12633 | from xml.etree import cElementTree as ElementTree
from django.test import TestCase
from casexml.apps.case.tests.util import check_xml_line_by_line
from casexml.apps.phone.tests.utils import \
call_fixture_generator as call_fixture_generator_raw
from corehq.apps.fixtures import fixturegenerators
from corehq.apps.... | bsd-3-clause | fd5f3d30460cb058312132f08f99e625 | 35.938596 | 114 | 0.543972 | 3.792555 | false | true | false | false |
dimagi/commcare-hq | corehq/apps/case_importer/tracking/models.py | 1 | 2916 | from django.db import models
from jsonfield import JSONField
from memoized import memoized
from dimagi.utils.logging import notify_exception
from soil.progress import STATES
from soil.util import get_task
from corehq.apps.case_importer.tracking.task_status import (
TaskStatus,
get_task_status_json,
)
MAX_CO... | bsd-3-clause | 3d1b84c3f053ee689bd828449b3f2737 | 33.714286 | 115 | 0.673868 | 3.695817 | false | false | false | false |
dimagi/commcare-hq | corehq/motech/repeaters/tests/test_proxy_models.py | 1 | 15357 | import inspect
from uuid import uuid4
from django.db import models
from django.test import SimpleTestCase, TestCase
from dimagi.ext.couchdbkit import Document
from dimagi.utils.couch.migration import (
SyncCouchToSQLMixin,
SyncSQLToCouchMixin,
)
from corehq.motech.dhis2.repeaters import (
Dhis2EntityRepe... | bsd-3-clause | 1f4dd0fdd5dc4f7c8baf008186d22e34 | 35.564286 | 114 | 0.667513 | 3.578886 | false | true | false | false |
dimagi/commcare-hq | corehq/apps/case_importer/tracking/task_status.py | 1 | 4123 | from dimagi.ext import jsonobject
from dimagi.utils.logging import notify_exception
from soil.progress import STATES, get_task_status
from soil.util import get_task
class TaskStatus(jsonobject.StrictJsonObject):
# takes on values of soil.progress.STATES
state = jsonobject.IntegerProperty()
progress = json... | bsd-3-clause | 0cc9f5d1b8ce1a9a9f492b4e7cf3e2a1 | 34.239316 | 99 | 0.657288 | 4.367585 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/zapier/tests/test_utils.py | 1 | 1194 | from collections import namedtuple
from corehq.apps.accounting.models import (
BillingAccount,
DefaultProductPlan,
SoftwarePlanEdition,
Subscription,
)
from corehq.apps.domain.models import Domain
from corehq.apps.users.models import HQApiKey, WebUser
from corehq.apps.zapier.consts import CASE_TYPE_RE... | bsd-3-clause | 6f822bc9857965b2973dcdee2f70a878 | 40.172414 | 105 | 0.766332 | 3.36338 | false | true | false | false |
dimagi/commcare-hq | corehq/motech/migrations/0006_connection_settings.py | 1 | 2006 | from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('motech', '0005_requestlog_request_body'),
]
operations = [
migrations.AddField(
model_name='connectionsettings',
name='api_auth_settings',
field=models.C... | bsd-3-clause | 02e8d38cf7bff7855bde972b2fa88744 | 34.192982 | 74 | 0.534397 | 4.457778 | false | false | false | false |
dimagi/commcare-hq | corehq/apps/accounting/tests/test_renew_subscription.py | 1 | 3162 | import datetime
from corehq.apps.accounting.models import (
BillingAccount,
DefaultProductPlan,
SoftwarePlanEdition,
Subscription,
)
from corehq.apps.accounting.tests import generator
from corehq.apps.accounting.tests.base_tests import BaseAccountingTest
from corehq.apps.domain.models import Domain
c... | bsd-3-clause | 37a4dbbf8252a39c8a544739be136858 | 35.344828 | 110 | 0.683112 | 4.08 | false | true | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.