max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 7 115 | max_stars_count int64 101 368k | id stringlengths 2 8 | content stringlengths 6 1.03M |
|---|---|---|---|---|
tests/baseline_data.py | jakiee3y/luma.core | 114 | 11188716 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2017-18 <NAME> and contributors
# See LICENSE.rst for details.
def primitives(device, draw):
padding = 2
shape_width = 20
top = padding
bottom = device.height - padding - 1
draw.rectangle(device.bounding_box, outline="white", fill="blac... |
examples/custom_op/train.py | jnclt/simple_tensorflow_serving | 771 | 11188743 | <gh_stars>100-1000
#!/usr/bin/env python
import os
import numpy as np
import tensorflow as tf
from tensorflow.python.saved_model import builder as saved_model_builder
from tensorflow.python.saved_model import (
signature_constants, signature_def_utils, tag_constants, utils)
from tensorflow.python.util import comp... |
inferpy/util/iterables.py | PGM-Lab/InferPy | 140 | 11188762 | <gh_stars>100-1000
def get_shape(x):
""" Get the shape of an element x. If it is an element with a shape attribute, return it. If it is a list with more than
one element, compute the shape by checking the len, and the shape of internal elements. In that case, the shape must
be consistent. Finally, in other... |
python/fate_arch/federation/transfer_variable/_cleaner.py | hubert-he/FATE | 3,787 | 11188789 | #
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
test/library/packages/ProtobufProtocolSupport/endToEnd/oneofs/write.py | jhh67/chapel | 1,602 | 11188850 | import oneofs_pb2
messageObj = oneofs_pb2.Foo()
messageObj.co = oneofs_pb2.color.green
messageObj.name = b"chapel";
messageObj.mfield.a = 67
messageObj.ifield = 45
file = open("out", "wb")
file.write(messageObj.SerializeToString())
file.close()
|
python-sdk/nuscenes/scripts/export_instance_videos.py | bjajoh/nuscenes-devkit | 1,284 | 11188859 | <filename>python-sdk/nuscenes/scripts/export_instance_videos.py
# nuScenes dev-kit.
# Code written by <NAME>, 2020.
"""
Generate videos of nuScenes object instances.
See https://github.com/EricWiener/nuscenes-instance-videos for more detailed instructions.
Usage: python3 generate_videos.py --dataroot <path to data> -... |
tests/samples/method_and_prefix.py | spamegg1/snoop | 751 | 11188890 | <filename>tests/samples/method_and_prefix.py
from snoop.configuration import Config
snoop = Config(prefix='ZZZ').snoop
class Baz(object):
def __init__(self):
self.x = 2
@snoop(watch='self.x')
def square(self):
foo = 7
self.x **= 2
return self
def main():
baz = Baz()... |
pystiche/enc/models/alexnet.py | dooglewoogle/pystiche | 129 | 11189028 | <reponame>dooglewoogle/pystiche
from typing import Any, Dict, List, Tuple
from torch import nn
from torchvision.models import alexnet
from torchvision.models.alexnet import model_urls as TORCH_MODEL_URLS
from .utils import ModelMultiLayerEncoder, select_url
__all__ = ["AlexNetMultiLayerEncoder", "alexnet_multi_layer... |
tests/unit/nn/test_rnn.py | ethan-asapp/flambe | 148 | 11189031 | import pytest
from flambe.nn import RNNEncoder
import torch
import mock
@pytest.mark.parametrize("rnn_type", ['LSTM', 'random', ''])
def test_invalid_type(rnn_type):
with pytest.raises(ValueError):
RNNEncoder(
input_size=10,
hidden_size=20,
rnn_type=rnn_type
)
... |
xam/preprocessing/binning/base.py | topolphukhanh/xam | 357 | 11189037 | <reponame>topolphukhanh/xam
import numpy as np
from sklearn.base import BaseEstimator
from sklearn.base import TransformerMixin
from sklearn.exceptions import NotFittedError
from sklearn.utils import check_array
class BaseBinner(BaseEstimator, TransformerMixin):
@property
def cut_points(self):
raise ... |
tests/cli/agent/build/build_test.py | bbhunter/ostorlab | 113 | 11189062 | <reponame>bbhunter/ostorlab
"""Tests for CLI agent build command."""
from pathlib import Path
import docker
import pytest
from click import testing
from ostorlab.cli import rootcli
def testAgentBuildCLI_whenRequiredOptionFileIsMissing_showMessage():
"""Test ostorlab agent build CLI command without the required... |
Polar/polar_effectscatter.py | pyecharts/pyecharts_gallery | 759 | 11189064 | <reponame>pyecharts/pyecharts_gallery
import random
from pyecharts import options as opts
from pyecharts.charts import Polar
data = [(i, random.randint(1, 100)) for i in range(10)]
c = (
Polar()
.add(
"",
data,
type_="effectScatter",
effect_opts=opts.EffectOpts(scale=10, perio... |
recipes/Python/138889_extract_email_addresses/recipe-138889.py | tdiprima/code | 2,023 | 11189081 | def grab_email(files = []):
# if passed a list of text files, will return a list of
# email addresses found in the files, matched according to
# basic address conventions. Note: supports most possible
# names, but not all valid ones.
found = []
if files != None:
mailsrch = re.compil... |
examples/butteryfly_network.py | eric-downes/mesh-networking | 368 | 11189141 | # -*- coding: utf-8 -*-
# <NAME> 2016/10/08
# Butterfly Network
#
# Simulate a butterfly network where addresses can be used to determine routing paths.
# MIT 6.042J Mathematics for Computer Science: Lecture 9
# https://www.youtube.com/watch?v=bTyxpoi2dmM
import math
import time
from mesh.node import Node
from mesh.l... |
ros/geometry/tf_conversions/src/tf_conversions/posemath.py | numberen/apollo-platform | 742 | 11189155 | # Copyright (c) 2010, <NAME>, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of condition... |
utils/util.py | xyupeng/ContrastiveCrop | 148 | 11189204 | import math
import numpy as np
import torch
import random
class AverageMeter(object):
"""Computes and stores the average and current value"""
def __init__(self):
self.reset()
def reset(self):
self.val = 0
self.avg = 0
self.sum = 0
self.count = 0
def update(sel... |
django/contrib/gis/forms/__init__.py | pomarec/django | 285 | 11189217 | <filename>django/contrib/gis/forms/__init__.py
from django.forms import *
from .fields import (GeometryField, GeometryCollectionField, PointField,
MultiPointField, LineStringField, MultiLineStringField, PolygonField,
MultiPolygonField)
from .widgets import BaseGeometryWidget, OpenLayersWidget, OSMWidget
|
alipay/aop/api/domain/InstCashPoolAccountMappingVO.py | antopen/alipay-sdk-python-all | 213 | 11189291 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.InstAccountDTO import InstAccountDTO
from alipay.aop.api.domain.InstAccountDTO import InstAccountDTO
class InstCashPoolAccountMappingVO(object):
def __init__(self):
s... |
modeling/fuzzware_modeling/model_detection.py | felkal/fuzzware | 106 | 11189297 | import angr
import claripy
from itertools import chain
from .angr_utils import is_ast_mmio_address, contains_var, all_states, has_conditional_statements, state_vars_out_of_scope, state_contains_tracked_mmio_path_constraints, state_variables_involved_in_loop, in_scope_register_values
MAX_SET_MODEL_VAL_NUM = 16
# ===... |
configs/search_config.py | MarcAntoineAlex/DenseNAS-1 | 305 | 11189303 | <gh_stars>100-1000
from tools.collections import AttrDict
__C = AttrDict()
search_cfg = __C
__C.search_params=AttrDict()
__C.search_params.arch_update_epoch=10
__C.search_params.val_start_epoch=120
__C.search_params.sample_policy='prob' # prob uniform
__C.search_params.weight_sample_num=1
__C.search_params.softmax_... |
src/genie/libs/parser/iosxe/tests/ShowIpMsdpPeer/cli/equal/device_output_2_expected.py | balmasea/genieparser | 204 | 11189328 | expected_output = {
"vrf": {
"VRF1": {
"peer": {
"10.1.100.2": {
"peer_as": 1,
"session_state": "Up",
"resets": "0",
"connect_source": "Loopback0",
"connect_source_address": "10.1.... |
extraPackages/matplotlib-3.0.3/examples/lines_bars_and_markers/simple_plot.py | dolboBobo/python3_ios | 130 | 11189334 | <filename>extraPackages/matplotlib-3.0.3/examples/lines_bars_and_markers/simple_plot.py<gh_stars>100-1000
"""
===========
Simple Plot
===========
Create a simple plot.
"""
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
# Data for plotting
t = np.arange(0.0, 2.0, 0.01)
s = 1 + np.sin(2 * np.pi *... |
ByteNet/translator.py | paarthneekhara/byteNet-tensorflow | 345 | 11189339 | import tensorflow as tf
import ops
class ByteNet_Translator:
def __init__(self, options):
self.options = options
embedding_channels = 2 * options['residual_channels']
self.w_source_embedding = tf.get_variable('w_source_embedding',
[options['source_vocab_size'], embeddi... |
bindings/nodejs/nan/lib/sdb.gyp | XVilka/sdb | 123 | 11189351 | {
"targets": [
{
"target_name": "libsdb",
"type": "static_library",
"include_dirs": [
"sdb/src"
],
"sources": [
"sdb/src/sdb.c",
"sdb/src/fmt.c",
"sdb/src/array.c",
"sdb/src/base64.c",
"sdb/src/buffer.c",
"sdb/src/cdb.c",
"sdb/src/cdb_make.c",
"sdb/src/d... |
ZeroingArrays_2016/TestSizes.py | riverar/blogstuff | 323 | 11189355 | <reponame>riverar/blogstuff
"""
Test compilation of char array[BUF_SIZE] = {} versus char array[BUF_SIZE] = {0}
"""
import os
import subprocess
import sys
terse = False
if len(sys.argv) > 1:
if sys.argv[1].lower() == "--terse":
terse = True
else:
print "--terse is the only option to this prog... |
yt/units/unit_object.py | Xarthisius/yt | 360 | 11189362 | <reponame>Xarthisius/yt<filename>yt/units/unit_object.py
from unyt.unit_object import *
|
node_modules/python-shell/test/python/exit-code.py | brenocg29/TP1RedesInteligentes | 1,869 | 11189386 | <reponame>brenocg29/TP1RedesInteligentes
import sys
exit_code = int(sys.argv[1]) if len(sys.argv) > 1 else 0
sys.exit(exit_code)
|
chainer_chemistry/dataset/splitters/stratified_splitter.py | pfnet/chainerchem | 184 | 11189410 | <filename>chainer_chemistry/dataset/splitters/stratified_splitter.py
import numpy
import pandas
from chainer_chemistry.dataset.splitters.base_splitter import BaseSplitter
from chainer_chemistry.datasets.numpy_tuple_dataset import NumpyTupleDataset
def _approximate_mode(class_counts, n_draws):
"""Referred scikit-... |
scripts/data/jura2bbtxt.py | wuzzh/master_thesis_code | 206 | 11189427 | """
Script for translating the dataset from J<NAME> (jura) to BBTXT format.
Since this dataset contains only cars all objects will be assigned label 1.
A BBTXT file is formatted like this:
filename label confidence xmin ymin xmax ymax
filename label confidence xmin ymin xmax ymax
filename label confidence xmin ymin x... |
examples/numbersonly.py | shmuelamar/cbox | 164 | 11189456 | #!/usr/bin/env python3
import cbox
@cbox.stream()
def numbersonly(line):
"""returns the lines containing only numbers. bad lines reported to stderr.
if any bad line is detected, exits with exitcode 2.
"""
if not line.isnumeric():
raise ValueError('{} is not a number'.format(line))
return l... |
posthog/migrations/0194_set_property_type_for_time.py | dorucioclea/posthog | 7,409 | 11189480 | <reponame>dorucioclea/posthog
# Generated by Django 3.2.5 on 2021-12-22 09:13
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("posthog", "0193_auto_20211222_0912"),
]
operations = [
migrations.RunSQL(
sql="""
update posthog_p... |
texthero/representation.py | gagandeepreehal/texthero | 2,559 | 11189502 | <filename>texthero/representation.py
"""
Map words into vectors using different algorithms such as
TF-IDF, word2vec or GloVe.
"""
import pandas as pd
import numpy as np
from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer
from sklearn.manifold import TSNE
from sklearn.decomposition import PCA... |
PhysicsTools/RecoAlgos/python/TrackFullCloneSelector_cfi.py | ckamtsikis/cmssw | 852 | 11189516 | import FWCore.ParameterSet.Config as cms
trackFullCloneSelector = cms.EDFilter("TrackFullCloneSelector",
copyExtras = cms.untracked.bool(False), ## copies also extras and rechits on RECO
src = cms.InputTag("ctfWithMaterialTracks"),
cut = cms.string('(numberOfValidHits >= 8) & (normalizedChi2 < 5)'),
#... |
third_party/tests/Rsd/Processor/Tools/KanataConverter/RSD_Event.py | little-blue/Surelog | 670 | 11189530 | # -*- coding: utf-8 -*-
class RSD_Event(object):
""" Parser event types """
INIT = 0
STAGE_BEGIN = 1
STAGE_END = 2
STALL_BEGIN = 3
STALL_END = 4
RETIRE = 5
FLUSH = 6
LABEL = 7
|
tests/zeus/api/resources/test_build_file_coverage.py | conrad-kronos/zeus | 221 | 11189549 | <reponame>conrad-kronos/zeus
# flake8 is breaking with no empty lines up here NOQA
def test_build_file_coverage_list(
client,
default_login,
default_repo,
default_build,
default_filecoverage,
default_repo_access,
):
resp = client.get(
"/api/repos/{}/builds/{}/file-coverage".format(... |
utils/tensor_utils_test.py | garyxcheng/federated | 330 | 11189553 | <reponame>garyxcheng/federated<gh_stars>100-1000
# Copyright 2018, The TensorFlow Federated Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LI... |
fexm/evalscripts/eval_seeds.py | fgsect/fexm | 105 | 11189557 | import subprocess
import sys
import matplotlib.pyplot as plt
import os
import pandas as pd
def get_file_bucket(file):
file_bucket = " ".join(str(subprocess.check_output("file {0}".format(file),
shell=True).strip()).split(":")[1].split(",")[0].strip().split(
... |
teuthology/openstack/test/test_config.py | varshar16/teuthology | 117 | 11189564 | from teuthology.config import config
class TestOpenStack(object):
def setup(self):
self.openstack_config = config['openstack']
def test_config_clone(self):
assert 'clone' in self.openstack_config
def test_config_user_data(self):
os_type = 'rhel'
os_version = '7.0'
... |
playground/pythonic-doom-fire/pythonic-doom-fire/example/doom_fire_pygame.py | jpalvesl/doom-fire-algorithm | 1,227 | 11189566 | <reponame>jpalvesl/doom-fire-algorithm
from os.path import dirname, abspath, join
import pygame
import sys
doom_fire_pygame_dir = dirname(abspath(__file__))
sys.path.append(join(doom_fire_pygame_dir, '..'))
from doom_fire import DoomFire
class DoomFirePygame(DoomFire):
def render(self, ctx):
ps = self.pixe... |
pyjobs/core/managers.py | Mdslino/PyJobs | 132 | 11189591 | from datetime import datetime, timedelta
from django.db import models
class PublicQuerySet(models.QuerySet):
def public(self):
return self.filter(public=True)
def premium(self):
return self.public().filter(premium=True)
def not_premium(self):
return self.public().filter(premium=F... |
tools/live_plot.py | francescodelduchetto/gazr | 174 | 11189610 | <filename>tools/live_plot.py
#! /usr/bin/env python
import sys
import time
from numpy import arange
import matplotlib.pyplot as plt
PLOT_WIDTH=100
plt.axis([0, PLOT_WIDTH, -90, 90])
plt.ion()
pitch = [0] * PLOT_WIDTH
yaw = [0] * PLOT_WIDTH
roll = [0] * PLOT_WIDTH
pitch_graph, yaw_graph, roll_graph = plt.plot(pitch,... |
easyargs/decorators.py | carlwgeorge/easyargs | 160 | 11189662 | from . import parsers
import functools
import inspect
def make_easy_args(obj=None, auto_call=True):
def decorate(f):
@functools.wraps(f)
def decorated(*args, **kwargs):
parser = parsers.create_base_parser(f)
if inspect.isfunction(f):
parsers.function_parser(... |
neuralmonkey/attention/__init__.py | Simon-Will/neuralmonkey | 446 | 11189664 | from .feed_forward import Attention
from .coverage import CoverageAttention
from .scaled_dot_product import ScaledDotProdAttention
|
causallib/contrib/shared_sparsity_selection/__init__.py | liranszlak/causallib | 350 | 11189694 | from .shared_sparsity_selection import SharedSparsityConfounderSelection
|
tests/r/test_strike_nb.py | hajime9652/observations | 199 | 11189710 | <reponame>hajime9652/observations<gh_stars>100-1000
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.strike_nb import strike_nb
def test_strike_nb():
"""Test module strike_nb.py by downloading
... |
StackApp/env/lib/python2.7/site-packages/flask_api/exceptions.py | jonathanmusila/StackOverflow-Lite | 555 | 11189751 | <reponame>jonathanmusila/StackOverflow-Lite<filename>StackApp/env/lib/python2.7/site-packages/flask_api/exceptions.py
from __future__ import unicode_literals
from flask_api import status
class APIException(Exception):
status_code = status.HTTP_500_INTERNAL_SERVER_ERROR
detail = ''
def __init__(self, deta... |
rpmvenv/extensions/core.py | oleynikandrey/rpmvenv | 150 | 11189834 | """Extension which accounts for the core RPM metadata fields."""
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from confpy.api import Configuration
from confpy.api import Namespace
from confpy.api import StringOptio... |
topik/fileio/base_output.py | ContinuumIO/topik | 104 | 11189838 | <filename>topik/fileio/base_output.py<gh_stars>100-1000
from abc import ABCMeta, abstractmethod
from six import with_metaclass
import jsonpickle
from ._registry import registered_outputs
class OutputInterface(with_metaclass(ABCMeta)):
def __init__(self, *args, **kwargs):
super(OutputInterface, self).__i... |
tests/test_application.py | william-wambua/rpc.py | 152 | 11189858 | import asyncio
import json
import sys
import time
from typing import AsyncGenerator, Generator
import httpx
import pytest
from rpcpy.application import RPC, AsgiRPC, WsgiRPC
from rpcpy.serializers import SERIALIZER_NAMES, SERIALIZER_TYPES
from rpcpy.typing import TypedDict
def test_wsgirpc():
rpc = RPC()
as... |
tools/bin/pythonSrc/pychecker-0.8.18/pychecker2/tests/nested.py | YangHao666666/hawq | 450 | 11189867 | <filename>tools/bin/pythonSrc/pychecker-0.8.18/pychecker2/tests/nested.py
class N1:
class N2:
x = 1
class N3:
pass
|
preprocessing/compute_distances.py | enviromachinebeast/head2head | 206 | 11189870 | import cv2
import os
import numpy as np
import argparse
import collections
import torch
import itertools
from tqdm import tqdm
from preprocessing import transform
from reconstruction import NMFCRenderer
IMG_EXTENSIONS = ['.png']
def is_image_file(filename):
return any(filename.endswith(extension) for extension in... |
codingame/easy/Chuck Norris.py | DazEB2/SimplePyScripts | 117 | 11189880 | <gh_stars>100-1000
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
import sys
import math
# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.
message = input()
print(message, file=sys.stderr)
# Write an action using print
# To debug... |
johnny/utils.py | bennylope/johnny-cache | 124 | 11189919 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Extra johnny utilities."""
from johnny.cache import get_backend, local, patch, unpatch
from johnny.decorators import wraps, available_attrs
__all__ = ["celery_enable_all", "celery_task_wrapper", "johnny_task_wrapper"]
def prerun_handler(*args, **kwargs):
"""Cel... |
tests/ut/python/privacy/sup_privacy/test_model_train.py | hboshnak/mindarmour | 139 | 11189936 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
test/python/test_sparse.py | LinjianMa/ctf | 108 | 11190071 | <reponame>LinjianMa/ctf
#!/usr/bin/env python
import unittest
import numpy
import ctf
import os
import sys
def allclose(a, b):
return abs(ctf.to_nparray(a) - ctf.to_nparray(b)).sum() < 1e-14
class KnowValues(unittest.TestCase):
def test_einsum_hadamard(self):
n = 11
a1 = ctf.tensor((n,n,n), ... |
code/doubanUtils.py | zefengdaguo/douban_crawler | 116 | 11190101 | <filename>code/doubanUtils.py
import requests
import csv, os, os.path, re
from functools import reduce
from bs4 import BeautifulSoup
from time import localtime,strftime,perf_counter,strptime
user_agent_list = ["Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.3... |
tools/Ubertooth/host/python/extcap/btle-extcap.py | Charmve/BLE-Security-Att-Def | 149 | 11190106 | <reponame>Charmve/BLE-Security-Att-Def<gh_stars>100-1000
#!/usr/bin/env python
# Copyright 2013 <NAME>
#
# This file is part of Project Ubertooth.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundati... |
build/python-env/lib/python2.7/site-packages/nose/exc.py | rfraposa/hadoopbeat | 5,079 | 11190128 | """Exceptions for marking tests as skipped or deprecated.
This module exists to provide backwards compatibility with previous
versions of nose where skipped and deprecated tests were core
functionality, rather than being provided by plugins. It may be
removed in a future release.
"""
from nose.plugins.skip import Skip... |
ahmia/views_search.py | keyboardcowboy42/ahmia | 176 | 11190173 | <gh_stars>100-1000
"""
Views
Full text search views.
YaCy back-end connections.
"""
import time
import urllib2 # URL encode
import simplejson as json
import urllib3 # HTTP conncetions
from django.conf import settings # For the back-end connection settings
from django.core.exceptions import ObjectDoesNotExist
from... |
tests/unit/core/addresscodec/test_main_test_cases.py | SubCODERS/xrpl-py | 216 | 11190207 | test_cases = [
[
"<KEY>",
None,
"<KEY>",
"<KEY>",
],
[
"<KEY>",
1,
"<KEY>",
"<KEY>",
],
[
"<KEY>",
14,
"<KEY>",
"<KEY>",
],
[
"<KEY>",
11747,
"<KEY>",
"<KEY>",
... |
static/scripts/tools/gis_update_location_tree.py | whanderley/eden | 205 | 11190213 | #!/usr/bin/python
# This is a script to update the Location Tree in the Database
# Needs to be run in the web2py environment
# python web2py.py -S eden -M -R applications/eden/static/scripts/tools/gis_update_location_tree.py
s3db.gis_location
gis.update_location_tree()
db.commit()
|
opendeep/models/single_layer/restricted_boltzmann_machine.py | vitruvianscience/OpenDeep | 252 | 11190217 | <filename>opendeep/models/single_layer/restricted_boltzmann_machine.py
"""
This module provides the RBM. http://deeplearning.net/tutorial/rbm.html
Boltzmann Machines (BMs) are a particular form of energy-based model which
contain hidden variables. Restricted Boltzmann Machines further restrict BMs
to those without vis... |
bin/chunks.py | cwickham/merely-useful.github.io | 190 | 11190238 | #!/usr/bin/env python
'''
chunks.py [source_file...]
Check that all chunks are either naked (no language spec) or have a recognizable
language and a label. If no source files are given, reads from standard input.
'''
import sys
import re
from util import LANGUAGES, read_all_files, report
MARKER = '```'
RICH_MARK... |
mlens/parallel/tests/test_a_learner_full.py | mehrdad-shokri/mlens | 760 | 11190260 | """"ML-ENSEMBLE
Testing suite for Learner and Transformer
"""
from mlens.testing import Data, EstimatorContainer, get_learner, run_learner
def test_predict():
"""[Parallel | Learner | Full | No Proba | No Prep] test fit and predict"""
args = get_learner('predict', 'full', False, False)
run_learner(*args)... |
Python3/687.py | rakhi2001/ecom7 | 854 | 11190267 | __________________________________________________________________________________________________
sample 336 ms submission
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def helper(se... |
piwheels/monitor/sense/renderers.py | jgillis/piwheels | 120 | 11190281 | #!/usr/bin/env python
# The piwheels project
# Copyright (c) 2017 <NAME> <https://github.com/bennuttall>
# Copyright (c) 2017 <NAME> <<EMAIL>>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributio... |
test_autolens/point/test_point_source.py | Jammy2211/AutoLens | 114 | 11190309 | <reponame>Jammy2211/AutoLens
from os import path
import shutil
import os
import numpy as np
import autolens as al
def test__point_dataset_structures_as_dict():
point_dataset_0 = al.PointDataset(
name="source_1",
positions=al.Grid2DIrregular([[1.0, 1.0]]),
positions_noise_map... |
alipay/aop/api/domain/AlipayCommerceOperationPoiVendingUploadModel.py | antopen/alipay-sdk-python-all | 213 | 11190336 | <filename>alipay/aop/api/domain/AlipayCommerceOperationPoiVendingUploadModel.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.BusinessHoursDesc import BusinessHoursDesc
class AlipayCommerceOperationPoiVendingUploadModel(objec... |
jasmin/protocols/cli/configs.py | paradiseng/jasmin | 750 | 11190386 | """
Config file handler for 'jcli' section in jasmin.cfg
"""
import os
import logging
import binascii
from jasmin.config import ConfigFile
ROOT_PATH = os.getenv('ROOT_PATH', '/')
LOG_PATH = os.getenv('LOG_PATH', '%s/var/log/jasmin/' % ROOT_PATH)
class JCliConfig(ConfigFile):
"""Config handler for 'jcli' section... |
elliot/recommender/latent_factor_models/SVDpp/__init__.py | gategill/elliot | 175 | 11190409 | from .svdpp import SVDpp |
scripts/release_test/tests/simpixel.py | rec/leds | 253 | 11190476 | import common
FEATURES = 'browser',
PROJECTS = 'sim-strip.yml', 'sim-matrix.yml', 'sim-cube.yml', 'sim-circle.yml',
def run():
common.test_prompt('simpixel')
common.run_project(*PROJECTS, flag='-s')
|
tests/core/permissions/test_models.py | jeanmask/opps | 159 | 11190477 | <reponame>jeanmask/opps
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.test import TestCase
from django.contrib.sites.models import Site
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group
from opps.channels.models import Channel
from opps.core.permissions.models impo... |
scale/ingest/views.py | kaydoh/scale | 121 | 11190507 | """Defines the views for the RESTful ingest and Strike services"""
from __future__ import unicode_literals
import datetime
import logging
import json
import rest_framework.status as status
from rest_framework.renderers import JSONRenderer
from django.http import JsonResponse
from django.http.response import Http404
i... |
minihack/scripts/download_boxoban_levels.py | samvelyan/minihack-1 | 217 | 11190509 | <reponame>samvelyan/minihack-1
# Copyright (c) Facebook, Inc. and its affiliates.
import os
import zipfile
import pkg_resources
DESTINATION_PATH = pkg_resources.resource_filename("minihack", "dat")
BOXOBAN_REPO_URL = (
"https://github.com/deepmind/boxoban-levels/archive/refs/heads/master.zip"
)
def download_box... |
the_archive/archived_rapids_blog_notebooks/azureml/rapids/init_dask.py | ssayyah/notebooks-contrib | 155 | 11190526 | import sys
import argparse
import time
import threading
import subprocess
import socket
from mpi4py import MPI
from azureml.core import Run
from notebook.notebookapp import list_running_servers
def flush(proc, proc_log):
while True:
proc_out = proc.stdout.readline()
if proc_out == '' and proc.poll() is not ... |
tests/data/photos_data.py | nicx/icloud-drive-docker | 196 | 11190590 | DATA = {
"query?remapEnums=True&getCurrentSyncToken=True": [
{
"data": {
"query": {"recordType": "CheckIndexingState"},
"zoneID": {"zoneName": "PrimarySync"},
},
"response": {
"records": [
{
... |
gitplus/cmd_git_semver.py | tkrajina/git-plus | 170 | 11190629 | #!/usr/bin/env python3
# Copyright 2013 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... |
tests/test_02_app/app_with_installs/app/main.py | coinforensics/uwsgi-nginx-docker | 597 | 11190640 | import sys
from flask import Flask
application = Flask(__name__)
@application.route("/")
def hello():
version = "{}.{}".format(sys.version_info.major, sys.version_info.minor)
message = "Hello World from Nginx uWSGI Python {} app in a Docker container".format(
version
)
return message
|
tests/integrational/native_sync/test_fire.py | panchiwalashivani/python | 146 | 11190648 | from tests.helper import pnconf_copy
from tests.integrational.vcr_helper import pn_vcr
from pubnub.structures import Envelope
from pubnub.pubnub import PubNub
from pubnub.models.consumer.pubsub import PNFireResult
from pubnub.models.consumer.common import PNStatus
@pn_vcr.use_cassette('tests/integrational/fixtures/na... |
interactive.py | bckim92/sequential-knowledge-transformer | 135 | 11190675 | import os
import math
from pprint import PrettyPrinter
import random
import numpy as np
import torch
import sklearn
import tensorflow as tf
import better_exceptions
from tqdm import tqdm, trange
import colorlog
import colorful
from utils.etc_utils import set_logger, set_tcmalloc, set_gpus, check_none_gradients
from u... |
test/programytest/config/brain/test_tokenizer.py | cdoebler1/AIML2 | 345 | 11190683 | import unittest
from programy.clients.events.console.config import ConsoleConfiguration
from programy.config.brain.tokenizer import BrainTokenizerConfiguration
from programy.config.file.yaml_file import YamlConfigurationFile
class BrainTokenizerConfigurationTests(unittest.TestCase):
def test_with_data(self):
... |
app/utils/proxy.py | ErictheSam/ASoulCnki | 384 | 11190686 | # timer
from threading import Timer
from requests import get
class ProxyPool():
def __init__(self, proxyConfig, interval=True, intervalRange=60):
'''
@param proxyConfig: like proxies in requests.get()
@param interval: start interval
@param intervalRange: interval range ... |
sympy/parsing/autolev/test-examples/ruletest10.py | iamabhishek0/sympy | 603 | 11190689 | <reponame>iamabhishek0/sympy
import sympy.physics.mechanics as me
import sympy as sm
import math as m
import numpy as np
x, y = me.dynamicsymbols('x y')
a, b = sm.symbols('a b', real=True)
e = a*(b*x+y)**2
m = sm.Matrix([e,e]).reshape(2, 1)
e = e.expand()
m = sm.Matrix([i.expand() for i in m]).reshape((m).shape[0], (m... |
Ch9/CG.py | jason-168/MLCode | 146 | 11190735 |
# Code from Chapter 9 of Machine Learning: An Algorithmic Perspective (2nd Edition)
# by <NAME> (http://stephenmonika.net)
# You are free to use, change, or redistribute the code in any way you wish for
# non-commercial purposes, but please maintain the name of the original author.
# This code comes with no warranty ... |
vilt/utils/write_nlvr2.py | kris927b/ViLT | 587 | 11190743 | import json
import pandas as pd
import pyarrow as pa
import os
from tqdm import tqdm
from collections import defaultdict
def process(root, iden, row):
texts = [r["sentence"] for r in row]
labels = [r["label"] for r in row]
split = iden.split("-")[0]
if iden.startswith("train"):
directory = ... |
sky/legacy/titletests.py | Asteur/sky_python_crawler | 325 | 11190747 | <filename>sky/legacy/titletests.py
import numpy
# TITLE TESTS
try:
from .training import Training
from .helper import *
from .findTitle import getTitle
except SystemError:
from training import Training
from helper import *
from findTitle import getTitle
# title = normalize(''.join([x fo... |
benchmarks/django-workload/uwsgi/files/django-workload/django_workload/feed_timeline.py | jonasbn/cloudsuite | 103 | 11190783 | <reponame>jonasbn/cloudsuite
class FeedTimeline(object):
def __init__(self, request):
self.request = request
def get_timeline(self):
user = self.request.user
feed = user.feed_entries().limit(20)
user_info = user.json_data
result = {
'num_r... |
mercari/main_mx.py | lammda/mercari-solution | 249 | 11190786 | <reponame>lammda/mercari-solution<filename>mercari/main_mx.py<gh_stars>100-1000
import sys
from mercari.config import TEST_SIZE
from mercari.datasets_mx import (
prepare_vectorizer_1, prepare_vectorizer_3, prepare_vectorizer_2,
)
from mercari.main_helpers import main
from mercari.mx_sparse import MXRegression, MXR... |
Source/ThirdParty/aes/python_binding/setup.py | HanasakiHonoka/ds3os | 651 | 11190792 | #!/usr/bin/env python
import platform
from distutils.core import setup, Extension
source_files = ['aesmodule.c', '../aeskey.c', '../aes_modes.c', '../aestab.c', '../aescrypt.c']
cflags = []
if platform.system() == 'Linux':
cflags.append('-Wno-sequence-point')
if platform.machine() == 'x86_64':
source_files.... |
tests/loan-closing/test_LoanClosing.py | DryptoBZX/contractsV2 | 177 | 11190845 | # #!/usr/bin/python3
# import pytest
# from brownie import Wei, reverts
# more complex scenario here in the future
|
scripts/automation/trex_control_plane/interactive/trex/wireless/services/trex_stl_ap.py | timgates42/trex-core | 956 | 11190861 | import base64
import random
import struct
import sys
import threading
import time
from collections import deque
from enum import Enum
import simpy
import wireless.pubsub.pubsub as pubsub
from scapy.all import *
from scapy.contrib.capwap import *
from scapy.contrib.capwap import CAPWAP_PKTS
from trex_openssl import *
#... |
gramformer/__init__.py | shashankdeshpande/Gramformer | 971 | 11190867 | <reponame>shashankdeshpande/Gramformer
from gramformer.gramformer import Gramformer
|
nucleoatac/diff_occ.py | RavelBio/NucleoATAC | 101 | 11190896 | <reponame>RavelBio/NucleoATAC<filename>nucleoatac/diff_occ.py
"""
Script to make nucleosome occupancy track!
@author: <NAME>
"""
##### IMPORT MODULES #####
# import necessary python modules
import multiprocessing as mp
import numpy as np
import traceback
import itertools
import pysam
from pyatac.utils import shell_co... |
finrl_meta/env_future_trading/wt4elegantrl/envs.py | eitin-infant/FinRL-Meta | 214 | 11190922 | from gym import Env
from gym.spaces import Box, Space
from features import Feature
from stoppers import Stopper
from assessments import Assessment
from wtpy.apps import WtBtAnalyst
from wtpy.WtBtEngine import WtBtEngine
from strategies import StateTransfer, EngineType
from multiprocessing import Pipe, Process
from os ... |
climlab/surface/turbulent.py | nfeldl/climlab | 160 | 11190930 | '''Processes for surface turbulent heat and moisture fluxes
:class:`~climlab.surface.SensibleHeatFlux` and
:class:`~climlab.surface.LatentHeatFlux` implement standard bulk formulae
for the turbulent heat fluxes, assuming that the heating or moistening
occurs in the lowest atmospheric model level.
:Example:
... |
tests/modules/contrib/test_vpn.py | spxtr/bumblebee-status | 1,089 | 11190947 | import pytest
pytest.importorskip("tkinter")
def test_load_module():
__import__("modules.contrib.vpn")
|
persephone/tests/test_transcription_preprocessing.py | a-tsioh/persephone | 133 | 11190955 | <filename>persephone/tests/test_transcription_preprocessing.py
def test_segment_into_chars():
from persephone.preprocess.labels import segment_into_chars
input_1 = "hello"
output_1 = "h e l l o"
input_2 = "hello world"
output_2 = "h e l l o w o r l d"
input_3 = "hello wo rld"
output_3... |
packages/vaex-core/vaex/registry.py | sethvargo/vaex | 337 | 11190973 | """This module contains the `register_function` decorator to add expression methods to vaex dataframe."""
import functools
import vaex.arrow
import vaex.expression
import vaex.multiprocessing
scopes = {
'str': vaex.expression.StringOperations,
'str_pandas': vaex.expression.StringOperationsPandas,
'dt': v... |
graphql_compiler/cost_estimation/__init__.py | manesioz/graphql-compiler | 521 | 11190981 | <gh_stars>100-1000
# Copyright 2019-present Kensho Technologies, LLC.
"""Query cost estimator.
Purpose
=======
Compiled GraphQL queries are sometimes too expensive to execute, in two ways:
- They return too many results: high *cardinality*.
- They require too many operations: high *execution cost*.
If these impracti... |
jacinle/random/rng.py | dapatil211/Jacinle | 114 | 11190992 | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
# File : rng.py
# Author : <NAME>
# Email : <EMAIL>
# Date : 01/19/2018
#
# This file is part of Jacinle.
# Distributed under terms of the MIT license.
import os
import random as sys_random
import numpy as np
import numpy.random as npr
from jacinle.utils.defaults ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.