max_stars_repo_path stringlengths 3 269 | max_stars_repo_name stringlengths 4 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.05M | score float64 0.23 5.13 | int_score int64 0 5 |
|---|---|---|---|---|---|---|
report_writer/report_writer.py | DoubleBridges/door-order-parser | 0 | 500 | from reportlab.lib.units import inch
from reportlab.platypus import SimpleDocTemplate, Spacer
from reportlab.rl_config import defaultPageSize
from reportlab.lib.units import inch
from reportlab.platypus.flowables import Flowable
def generate_order(job, path, door_style, doors=[], drawers=[]):
PAGE_HEIGHT = defaul... | 2.421875 | 2 |
app/retweet_graphs_v2/prep/migrate_daily_bot_probabilities.py | s2t2/tweet-analyzer-py | 5 | 501 | <reponame>s2t2/tweet-analyzer-py
from app.bq_service import BigQueryService
if __name__ == "__main__":
bq_service = BigQueryService()
bq_service.migrate_daily_bot_probabilities_table()
print("MIGRATION SUCCESSFUL!")
| 1.914063 | 2 |
colosseum/mdps/minigrid_doorkey/minigrid_doorkey.py | MichelangeloConserva/Colosseum | 0 | 502 | <gh_stars>0
from copy import deepcopy
from dataclasses import asdict, dataclass
from enum import IntEnum
from colosseum.utils.random_vars import deterministic, get_dist
try:
from functools import cached_property
except:
from backports.cached_property import cached_property
from typing import Any, Dict, List,... | 2.171875 | 2 |
tests/bugs/core_6266_test.py | reevespaul/firebird-qa | 0 | 503 | <filename>tests/bugs/core_6266_test.py
#coding:utf-8
#
# id: bugs.core_6266
# title: Deleting records from MON$ATTACHMENTS using ORDER BY clause doesn't close the corresponding attachments
# decription:
# Old title: Don't close attach while deleting record from MON$ATTACHMENTS usin... | 1.359375 | 1 |
scripts/senate_crawler.py | tompsh/tompsh.github.io | 0 | 504 | from bs4 import BeautifulSoup
import logging
import pandas as pd
import csv
import re
import requests
from urllib.parse import urljoin
logging.basicConfig(format="%(asctime)s %(levelname)s:%(message)s", level=logging.INFO)
def get_html(url):
return requests.get(url).text
class SenateCrawler:
def __init__(... | 3.03125 | 3 |
backend-project/small_eod/autocomplete/tests/test_views.py | merito/small_eod | 64 | 505 | from test_plus.test import TestCase
from ...administrative_units.factories import AdministrativeUnitFactory
from ...cases.factories import CaseFactory
from ...channels.factories import ChannelFactory
from ...events.factories import EventFactory
from ...features.factories import FeatureFactory, FeatureOptionFactory
fro... | 2.109375 | 2 |
src/lennybot/model/plan.py | raynigon/lenny-bot | 1 | 506 | <filename>src/lennybot/model/plan.py
from typing import Any, List
from ..actions.iaction import IAction
from ..model.state import LennyBotState
class LennyBotPlan:
def __init__(self, state: LennyBotState, actions: List[IAction]) -> None:
self._state = state
self._actions = actions
@proper... | 2.328125 | 2 |
laceworksdk/api/container_registries.py | kiddinn/python-sdk | 10 | 507 | # -*- coding: utf-8 -*-
"""
Lacework Container Registries API wrapper.
"""
import logging
logger = logging.getLogger(__name__)
class ContainerRegistriesAPI(object):
"""
Lacework Container Registries API.
"""
def __init__(self, session):
"""
Initializes the ContainerRegistriesAPI obj... | 2.375 | 2 |
mllib/nlp/seq2seq.py | pmaxit/dlnotebooks | 0 | 508 | <reponame>pmaxit/dlnotebooks<filename>mllib/nlp/seq2seq.py<gh_stars>0
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/01_seq2seq.ipynb (unless otherwise specified).
__all__ = ['Encoder', 'NewDecoder', 'Seq2Seq']
# Cell
from torch import nn
from torch import optim
import torch
import torch.nn.functional as F
from tor... | 2.390625 | 2 |
tests/flows/test_consent.py | mrkday/SATOSA | 92 | 509 | import json
import re
import responses
from werkzeug.test import Client
from werkzeug.wrappers import Response
from satosa.proxy_server import make_app
from satosa.satosa_config import SATOSAConfig
class TestConsent:
def test_full_flow(self, satosa_config_dict, consent_module_config):
api_url = "https:/... | 2.109375 | 2 |
qnarre/models/transfo_xl.py | quantapix/qnarre.com | 0 | 510 | <gh_stars>0
# Copyright 2022 Quantapix 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 ... | 1.414063 | 1 |
src/align/face_align_celeba.py | Dou-Yu-xuan/pykinship | 12 | 511 | import argparse
import glob
import os
import pickle
from pathlib import Path
import numpy as np
from PIL import Image
from tqdm import tqdm
from src.align.align_trans import get_reference_facial_points, warp_and_crop_face
# sys.path.append("../../")
from src.align.detector import detect_faces
if __name__ == "__main... | 2.296875 | 2 |
extract.py | rmalav15/voice-data-extract | 0 | 512 | from srtvoiceext import extract
if __name__ == '__main__':
ext = extract('video.mkv', 'subtitles.srt', 'outdir') | 1.515625 | 2 |
bacon/readonly_collections.py | aholkner/bacon | 37 | 513 | import collections
class ReadOnlyDict(collections.MutableMapping):
def __init__(self, store):
self.store = store
def __getitem__(self, key):
return self.store[key]
def __setitem__(self, key, value):
raise TypeError('Cannot modify ReadOnlyDict')
def __delitem__(self, ke... | 3.296875 | 3 |
rpg_game/gui.py | ricott1/twissh | 0 | 514 | # encoding: utf-8
import urwid
import time, os, copy
from rpg_game.utils import log, mod, distance
from rpg_game.constants import *
from urwid import raw_display
SIZE = lambda scr=raw_display.Screen(): scr.get_cols_rows()
MIN_HEADER_HEIGHT = 3
MAX_MENU_WIDTH = 48
FOOTER_HEIGHT = 4
PALETTE = [
("line",... | 1.890625 | 2 |
lale/lib/autogen/linear_regression.py | gbdrt/lale | 0 | 515 | from numpy import inf, nan
from sklearn.linear_model import LinearRegression as Op
from lale.docstrings import set_docstrings
from lale.operators import make_operator
class LinearRegressionImpl:
def __init__(self, **hyperparams):
self._hyperparams = hyperparams
self._wrapped_model = Op(**self._hy... | 2.453125 | 2 |
Models.py | jmj23/Kaggle-Pneumothorax | 0 | 516 | import numpy as np
from keras.applications.inception_v3 import InceptionV3
from keras.initializers import RandomNormal
from keras.layers import (BatchNormalization, Conv2D, Conv2DTranspose, Conv3D,
Cropping2D, Dense, Flatten, GlobalAveragePooling2D,
Input, Lambda, Max... | 2.921875 | 3 |
initdb.py | dasmerlon/flunky-bot | 0 | 517 | #!/bin/env python
"""Drop and create a new database with schema."""
from sqlalchemy_utils.functions import database_exists, create_database, drop_database
from flunkybot.db import engine, base
from flunkybot.models import * # noqa
db_url = engine.url
if database_exists(db_url):
drop_database(db_url)
create_datab... | 2.359375 | 2 |
setup.py | awesome-archive/webspider | 0 | 518 | <filename>setup.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from setuptools import find_packages, setup
from app import __version__
# get the dependencies and installs
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'requirements.txt')) as f:
all_requirements = f.read... | 1.429688 | 1 |
Doc/conf.py | python-doc-tw/cpython-tw | 0 | 519 | <reponame>python-doc-tw/cpython-tw
#
# Python documentation build configuration file
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't pickleable (module imports are okay, they're removed autom... | 2.046875 | 2 |
basic_stats.py/basic_stats.py | RahmB/basic_stats | 0 | 520 | <filename>basic_stats.py/basic_stats.py
# Import the matplotlib module here. No other modules should be used.
# Import plotting library
import matplotlib.pyplot as plt
#import....
from os import *
# Import Numpy
import numpy as np
def mean(my_list): # This is the defintion in the head.
i = 0
my_sum = 0
... | 3.90625 | 4 |
src/catkin_pkg/cli/tag_changelog.py | delftrobotics-forks/catkin_pkg | 2 | 521 | """This script renames the forthcoming section in changelog files with the upcoming version and the current date"""
from __future__ import print_function
import argparse
import datetime
import docutils.core
import os
import re
import sys
from catkin_pkg.changelog import CHANGELOG_FILENAME, get_changelog_from_path
fr... | 2.546875 | 3 |
tests/optims/distributed_adamw_test.py | AswinRetnakumar/Machina | 302 | 522 | import os
import unittest
import torch
import torch.distributed as dist
from torch.multiprocessing import Process
import torch.nn as nn
from machina.optims import DistributedAdamW
def init_processes(rank, world_size,
function, backend='tcp'):
os.environ['MASTER_ADDR'] = '127.0.0.1'
os.env... | 2.53125 | 3 |
rsqueakvm/model/__init__.py | shiplift/RSqueakOnABoat | 44 | 523 | <reponame>shiplift/RSqueakOnABoat<filename>rsqueakvm/model/__init__.py
"""
Squeak model.
W_Object
W_SmallInteger
W_MutableSmallInteger
W_AbstractObjectWithIdentityHash
W_AbstractFloat
W_Float
W_MutableFloat
W_Character
... | 1.429688 | 1 |
Multi-Task-Learning-PyTorch-master/losses/loss_functions.py | nikola3794/edge-evaluation-PASCAL-MT-tmp | 0 | 524 | <filename>Multi-Task-Learning-PyTorch-master/losses/loss_functions.py
# This code is referenced from
# https://github.com/facebookresearch/astmt/
#
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# License: Attribution-NonCommercial 4.0 International
import torch
import torch.nn as nn
im... | 2.515625 | 3 |
trabalho-numerico/tridimensional.py | heissonwillen/tcm | 0 | 525 | from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from matplotlib import cm
import numpy as np
import os
import contorno
from constantes import INTERVALOS, PASSOS, TAMANHO_BARRA, DELTA_T, DELTA_X
z_temp = contorno.p_3
TAMANHO_BARRA = 2
x = np.linspace(0.0, TAMANHO_BARRA, INTERVALOS+1)
y = np.lin... | 2.28125 | 2 |
leetcode/0006_ZigZag_Conversion/zigzag_conversion.py | zyeak/leetcode | 0 | 526 | # solution 1:
class Solution1:
def convert(self, s: str, numRows: int) -> str:
if numRows == 1 or numRows >= len(s):
return s
L = [''] * numRows
index, step = 0, 1
for x in s:
L[index] += x
if index == 0:
step = 1
... | 3.65625 | 4 |
FakeNewsClassifierWithLSTM.py | pratikasarkar/nlp | 0 | 527 | <reponame>pratikasarkar/nlp
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 11 13:42:45 2021
@author: ASUS
"""
import pandas as pd
df = pd.read_csv(r'D:\nlp\fake-news-data\train.csv')
df = df.dropna()
X = df.drop('label',axis = 1)
y = df['label']
import tensorflow as tf
from tensorflow.keras.layers import Embedding... | 2.734375 | 3 |
SVM/SVM_12_Quiz.py | rohit517/Intro-to-machine-learning-Udacity | 0 | 528 | import sys
from class_vis import prettyPicture
from prep_terrain_data import makeTerrainData
import matplotlib.pyplot as plt
import copy
import numpy as np
import pylab as pl
features_train, labels_train, features_test, labels_test = makeTerrainData()
########################## SVM ###################... | 2.75 | 3 |
tests/test_auto_scan_logsigmoid.py | yeliang2258/Paddle2ONNX | 0 | 529 | <gh_stars>0
# Copyright (c) 2021 PaddlePaddle 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 requir... | 2.078125 | 2 |
oasislmf/utils/concurrency.py | bbetov-corelogic/OasisLMF | 0 | 530 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from builtins import open
from builtins import str
from future import standard_library
standard_library.install_aliases()
try:
from queue i... | 2.375 | 2 |
runtime/python/Lib/site-packages/isort/output.py | hwaipy/InteractionFreeNode | 4 | 531 | <reponame>hwaipy/InteractionFreeNode<filename>runtime/python/Lib/site-packages/isort/output.py
import copy
import itertools
from functools import partial
from typing import Any, Iterable, List, Optional, Set, Tuple, Type
from isort.format import format_simplified
from . import parse, sorting, wrap
from .comments impo... | 2.125 | 2 |
vixen/project.py | amoeba/vixen | 10 | 532 | import datetime
import io
import json_tricks
import logging
import os
from os.path import (abspath, basename, dirname, exists, expanduser,
join, realpath, relpath, splitext)
import re
import shutil
import sys
from traits.api import (Any, Dict, Enum, HasTraits, Instance, List, Long,
... | 2.03125 | 2 |
prance/util/translator.py | elemental-lf/prance | 0 | 533 | """This submodule contains a JSON reference translator."""
__author__ = '<NAME>'
__copyright__ = 'Copyright © 2021 <NAME>'
__license__ = 'MIT'
__all__ = ()
import prance.util.url as _url
def _reference_key(ref_url, item_path):
"""
Return a portion of the dereferenced URL.
format - ref-url_obj-path
... | 2.53125 | 3 |
src/tests/stream.py | LakshyaaSoni/dropSQL | 35 | 534 | from io import StringIO
from unittest import TestCase
from dropSQL.parser.streams import *
class StreamTestCase(TestCase):
def test(self):
s = '12'
cs = Characters(StringIO(s))
ch = cs.peek().ok()
self.assertEqual(ch, '1')
ch = cs.peek().ok()
self.assertEqual(ch,... | 2.6875 | 3 |
tests/test_bugs.py | mmibrah2/OpenQL | 0 | 535 | <reponame>mmibrah2/OpenQL
import os
import filecmp
import unittest
import numpy as np
from openql import openql as ql
from utils import file_compare
curdir = os.path.dirname(os.path.realpath(__file__))
output_dir = os.path.join(curdir, 'test_output')
class Test_bugs(unittest.TestCase):
@classmethod
def setUp(... | 2.28125 | 2 |
utils/setAddress.py | wedvjin/rs485-moist-sensor | 1 | 536 | #!/usr/bin/python
"""Looks for sensor on the bus and changes it's address to the one specified on command line"""
import argparse
import minimalmodbus
import serial
from time import sleep
parser = argparse.ArgumentParser()
parser.add_argument('address', metavar='ADDR', type=int, choices=range(1, 248), help='An ad... | 3.125 | 3 |
python/ray/tune/tests/test_tune_save_restore.py | mgelbart/ray | 22 | 537 | # coding: utf-8
import os
import pickle
import shutil
import tempfile
import unittest
import ray
from ray import tune
from ray.rllib import _register_all
from ray.tune import Trainable
from ray.tune.utils import validate_save_restore
class SerialTuneRelativeLocalDirTest(unittest.TestCase):
local_mode = True
... | 2.28125 | 2 |
src/manifest.py | silent1mezzo/lightsaber | 13 | 538 | MANIFEST = {
"hilt": {
"h1": {
"offsets": {"blade": 0, "button": {"x": (8, 9), "y": (110, 111)}},
"colours": {
"primary": (216, 216, 216), # d8d8d8
"secondary": (141, 141, 141), # 8d8d8d
"tertiary": (180, 97, 19), # b46113
... | 1.257813 | 1 |
tests/gpuarray/test_basic_ops.py | canyon289/Theano-PyMC | 1 | 539 | import numpy as np
import pytest
import theano
import theano.tensor as tt
# Don't import test classes otherwise they get tested as part of the file
from tests import unittest_tools as utt
from tests.gpuarray.config import mode_with_gpu, mode_without_gpu, test_ctx_name
from tests.tensor.test_basic import (
TestAll... | 2.140625 | 2 |
apps/interactor/tests/commander/commands/test_animations.py | Djelibeybi/photons | 51 | 540 | <gh_stars>10-100
# coding: spec
from interactor.commander.store import store, load_commands
from photons_app.mimic.event import Events
from photons_app import helpers as hp
from photons_canvas.points.simple_messages import Set64
from unittest import mock
import pytest
@pytest.fixture()
def store_clone():
load... | 1.976563 | 2 |
.ipython/profile_pytube/startup/init.py | showa-yojyo/dotfiles | 0 | 541 | from pytube import YouTube
def download_video(watch_url):
yt = YouTube(watch_url)
(yt.streams
.filter(progressive=True, file_extension='mp4')
.order_by('resolution')
.desc()
.first()
.download())
| 2.8125 | 3 |
ament_tools/setup_arguments.py | richmattes/ament_tools | 1 | 542 | <filename>ament_tools/setup_arguments.py
# Copyright 2015 Open Source Robotics Foundation, Inc.
#
# 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.375 | 2 |
tests/functional/test_soft_round_inverse.py | tallamjr/NeuralCompression | 233 | 543 | <gh_stars>100-1000
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
from neuralcompression.functional import soft_round, soft_round_inverse
def test_soft_round_inverse():
... | 2.125 | 2 |
dizoo/pybullet/config/hopper_ppo_default_config.py | konnase/DI-engine | 2 | 544 | from easydict import EasyDict
hopper_ppo_default_config = dict(
env=dict(
env_id='HopperMuJoCoEnv-v0',
norm_obs=dict(use_norm=False, ),
norm_reward=dict(use_norm=False, ),
collector_env_num=8,
evaluator_env_num=10,
use_act_scale=True,
n_evaluator_episode=10,
... | 1.539063 | 2 |
cisco_sdwan_policy/List/Application.py | ljm625/cisco_sdwan_policy_python | 11 | 545 | import json
from cisco_sdwan_policy.BaseObject import BaseObject
class Application(BaseObject):
def __init__(self,name,app_list,is_app_family,id=None,reference=None,**kwargs):
self.type = "appList"
self.id = id
self.name = name
self.references = reference
self.app_family=... | 2.234375 | 2 |
supervisor/docker/dns.py | zeehio/supervisor | 0 | 546 | <filename>supervisor/docker/dns.py
"""DNS docker object."""
import logging
from ..const import ENV_TIME
from ..coresys import CoreSysAttributes
from .interface import DockerInterface
_LOGGER: logging.Logger = logging.getLogger(__name__)
DNS_DOCKER_NAME: str = "hassio_dns"
class DockerDNS(DockerInterface, CoreSysAt... | 2.25 | 2 |
nuitka/codegen/OperatorCodes.py | hclivess/Nuitka | 0 | 547 | <gh_stars>0
# Copyright 2019, <NAME>, mailto:<EMAIL>
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance w... | 1.710938 | 2 |
python_modules/dagster-graphql/dagster_graphql/implementation/external.py | rpatil524/dagster | 1 | 548 | <gh_stars>1-10
import sys
from dagster import check
from dagster.config.validate import validate_config_from_snap
from dagster.core.host_representation import ExternalPipeline, PipelineSelector, RepositorySelector
from dagster.core.workspace.context import BaseWorkspaceRequestContext
from dagster.utils.error import se... | 1.898438 | 2 |
tests/test_utils/test_pywriting_utils.py | heylohousing/quickbase-client | 0 | 549 | import os
from tempfile import TemporaryDirectory
from quickbase_client.utils.pywriting_utils import BasicPyFileWriter
from quickbase_client.utils.pywriting_utils import PyPackageWriter
class TestBasicFileWriter:
def test_outputs_lines(self):
w = BasicPyFileWriter()
w.add_line('import abc')
... | 2.546875 | 3 |
model/resnet.py | DrMMZ/RetinaNet | 7 | 550 | <filename>model/resnet.py
"""
Residual Networks (ResNet)
"""
# adapted from
# https://github.com/fchollet/deep-learning-models/blob/master/resnet50.py
import tensorflow as tf
def identity_block(
input_tensor,
filters,
stage,
block,
train_bn=False
):
"""
B... | 3.09375 | 3 |
src/main/python/rds_log_cat/parser/mysql57.py | Scout24/rds-log-cat | 1 | 551 | <reponame>Scout24/rds-log-cat
from rds_log_cat.parser.parser import Parser, LineParserException
class Mysql57(Parser):
def __init__(self):
Parser.__init__(self)
def compose_timestamp(self, datetime, timezone):
if len(datetime) != 27:
raise LineParserException('wrong length of dat... | 2.4375 | 2 |
corpustools/neighdens/neighborhood_density.py | PhonologicalCorpusTools/CorpusTools | 97 | 552 | from functools import partial
from corpustools.corpus.classes import Word
from corpustools.symbolsim.edit_distance import edit_distance
from corpustools.symbolsim.khorsi import khorsi
from corpustools.symbolsim.phono_edit_distance import phono_edit_distance
from corpustools.symbolsim.phono_align import Aligner
from co... | 2.671875 | 3 |
brokenChains/migrations/0003_auto_20181106_1819.py | bunya017/brokenChains | 1 | 553 | <gh_stars>1-10
# Generated by Django 2.1.1 on 2018-11-06 17:19
from django.conf import settings
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('brokenChains', '0002_auto_20181106_1723'),
]
... | 1.617188 | 2 |
ex05-td/ex05-td.py | vijaykumarprabhu/rl-course | 0 | 554 | import gym
import numpy as np
from itertools import product
import matplotlib.pyplot as plt
def print_policy(Q, env):
""" This is a helper function to print a nice policy from the Q function"""
moves = [u'←', u'↓',u'→', u'↑']
if not hasattr(env, 'desc'):
env = env.env
dims = env.desc.shape
... | 3.46875 | 3 |
app/modules/ai_lab/migrations/0003_ailabcasestudy.py | nickmoreton/nhsx-website | 50 | 555 | # Generated by Django 3.0.4 on 2020-07-14 11:00
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("core", "0026_auto_20200713_1535"),
("ai_lab", "0002_ailabusecase"),
]
operations = [
migrations.Cre... | 1.507813 | 2 |
requests/UpdateWorkbookConnectionRequest.py | divinorum-webb/python-tableau-api | 1 | 556 | <filename>requests/UpdateWorkbookConnectionRequest.py<gh_stars>1-10
from .BaseRequest import BaseRequest
class UpdateWorkbookConnectionRequest(BaseRequest):
"""
Update workbook connection request for sending API requests to Tableau Server.
:param ts_connection: The Tableau Server connection obj... | 3.265625 | 3 |
frappe/website/doctype/website_route_meta/test_website_route_meta.py | oryxsolutions/frappe | 0 | 557 | # -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import unittest
import frappe
from frappe.utils import set_request
from frappe.website.serve import get_response
test_dependencies = ["Blog Post"]
class TestWebsiteRouteMeta(unittest.TestCase):
def test_m... | 2.203125 | 2 |
test/unittests/test_AgRunoff.py | rajadain/gwlf-e | 0 | 558 | <reponame>rajadain/gwlf-e<filename>test/unittests/test_AgRunoff.py
import numpy as np
from .VariableUnitTest import VariableUnitTest
from gwlfe.MultiUse_Fxns.Runoff import AgRunoff
class TestAgRunoff(VariableUnitTest):
# @skip("not ready")
def test_AgRunoff(self):
z = self.z
np.testing.asser... | 1.851563 | 2 |
lingvo/tasks/car/car_layers_test.py | Harshs27/lingvo | 2,611 | 559 | # Lint as: python3
# Copyright 2019 The TensorFlow 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 ... | 2.34375 | 2 |
starry/_core/ops/lib/include/oblate/tests/test_derivs.py | rodluger/starry | 116 | 560 | <reponame>rodluger/starry<filename>starry/_core/ops/lib/include/oblate/tests/test_derivs.py
import oblate
import numpy as np
import pytest
# TODO!
| 1.023438 | 1 |
take_snapshot.py | ITCave/sniff-for-changes-in-directory | 0 | 561 | # -*- coding: utf-8 -*-
# @Filename : take_snapshot.py
# @Date : 2019-07-15-13-44
# @Project: ITC-sniff-for-changes-in-directory
# @Author: <NAME>
# @Website: http://itcave.eu
# @Email: <EMAIL>
# @License: MIT
# @Copyright (C) 2019 ITGO <NAME>
# Generic imports
import os
import pickle
import re
import argparse
from d... | 2.78125 | 3 |
nuitka/nodes/GlobalsLocalsNodes.py | juanfra684/Nuitka | 1 | 562 | # Copyright 2020, <NAME>, mailto:<EMAIL>
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... | 1.859375 | 2 |
tests/chainerx_tests/unit_tests/test_scalar.py | yuhonghong66/chainer | 1 | 563 | <reponame>yuhonghong66/chainer
import math
import pytest
import chainerx
def _check_cast_scalar_equals_data(scalar, data):
assert bool(scalar) == bool(data)
assert int(scalar) == int(data)
assert float(scalar) == float(data)
all_scalar_values = [
-2, 1, -1.5, 2.3, True, False, float('inf'), float(... | 2.5625 | 3 |
app.py | Tiemoue/SnakeGame | 0 | 564 | import sys
import pygame
from app_window import App_window
from button import Button
from snake import Snake
from food import Food
from settings import WIDTH, HEIGHT, FONT, BG_COL, QUIT_BUTTON_COLOUR, PLAY_BUTTON_COLOUR, BLACK, FPS, RED
class App:
def __init__(self):
pygame.init()
self.clock = pyg... | 2.96875 | 3 |
pupa/importers/bills.py | datamade/pupa | 3 | 565 | <filename>pupa/importers/bills.py<gh_stars>1-10
from pupa.utils import fix_bill_id
from opencivicdata.legislative.models import (Bill, RelatedBill, BillAbstract, BillTitle,
BillIdentifier, BillAction, BillActionRelatedEntity,
Bi... | 1.984375 | 2 |
utilities/classify_ensemble.py | Hazel1994/Paraphrase-detection-on-Quora-and-MSRP | 2 | 566 | from sklearn.metrics import f1_score,accuracy_score
import numpy as np
from utilities.tools import load_model
import pandas as pd
def predict_MSRP_test_data(n_models,nb_words,nlp_f,test_data_1,test_data_2,test_labels):
models=[]
n_h_features=nlp_f.shape[1]
print('loading the models...')
for i in range... | 2.71875 | 3 |
koino/plot/clusters.py | tritas/koino | 0 | 567 | # coding=utf-8
import logging
import traceback
from os import makedirs
from os.path import exists, join
from textwrap import fill
import matplotlib.patheffects as PathEffects
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from koino.plot import big_square, default_alpha
from matplotlib import... | 2.71875 | 3 |
python/testData/stubs/FullyQualifiedTypingNamedTuple.py | jnthn/intellij-community | 2 | 568 | import typing
nt = typing.NamedTuple("name", [("field", str)]) | 2.09375 | 2 |
src/plat/index_news_remove.py | jack139/cnnc | 0 | 569 | <reponame>jack139/cnnc
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
import web
import time
from bson.objectid import ObjectId
from config import setting
import helper
db = setting.db_web
# 删除聊天规则
url = ('/plat/index_news_remove')
class handler:
def GET(self):
if not helper.logged(helper.PRIV_USER, ... | 2.140625 | 2 |
esppy/windows/score.py | PetreStegaroiu/python-esppy | 0 | 570 | <filename>esppy/windows/score.py<gh_stars>0
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright SAS Institute
#
# 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... | 1.804688 | 2 |
Packs/Pwned/Integrations/PwnedV2/PwnedV2.py | diCagri/content | 799 | 571 | from CommonServerPython import *
''' IMPORTS '''
import re
import requests
# Disable insecure warnings
requests.packages.urllib3.disable_warnings()
''' GLOBALS/PARAMS '''
VENDOR = 'Have I Been Pwned? V2'
MAX_RETRY_ALLOWED = demisto.params().get('max_retry_time', -1)
API_KEY = demisto.params().get('api_key')
USE_SS... | 2.1875 | 2 |
moshmosh/extensions/pipelines.py | Aloxaf/moshmosh | 114 | 572 | <reponame>Aloxaf/moshmosh<gh_stars>100-1000
from moshmosh.extension import Extension
from moshmosh.ast_compat import ast
class PipelineVisitor(ast.NodeTransformer):
"""
`a | f -> f(a)`, recursively
"""
def __init__(self, activation):
self.activation = activation
def visit_BinOp(self, n: a... | 2.4375 | 2 |
postpatch.py | mr-ma/basic-self-checksumming | 1 | 573 | <reponame>mr-ma/basic-self-checksumming
import argparse
import os
import r2pipe
import struct
import mmap
import base64
from shutil import copyfile
import pprint
pp = pprint.PrettyPrinter(indent=4)
def precompute_hash(r2, offset, size):
print('Precomputing hash')
h = 0
print("r2 command to get the functio... | 2.671875 | 3 |
sitewebapp/migrations/0011_auto_20210130_0150.py | deucaleon18/debsoc-nitdgp-website | 2 | 574 | # Generated by Django 2.2.15 on 2021-01-29 20:20
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('sitewebapp', '0010_auditionanswers_auditionquestions_audtionrounds_candidates'),
]
operations = [
migratio... | 1.570313 | 2 |
venv/lib/python3.6/site-packages/ansible_collections/community/azure/plugins/modules/azure_rm_availabilityset_info.py | usegalaxy-no/usegalaxy | 1 | 575 | <reponame>usegalaxy-no/usegalaxy
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2016, <NAME> <<EMAIL>>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'me... | 1.71875 | 2 |
tests/v3_api/common.py | sowmyav27/rancher | 0 | 576 | import inspect
import json
import os
import random
import subprocess
import time
import requests
import ast
import paramiko
import rancher
from rancher import ApiError
from lib.aws import AmazonWebServices
DEFAULT_TIMEOUT = 120
DEFAULT_MULTI_CLUSTER_APP_TIMEOUT = 300
CATTLE_TEST_URL = os.environ.get('CATTLE_TEST_URL'... | 1.945313 | 2 |
LeetCode/Python3/String/20. Valid Parentheses.py | WatsonWangZh/CodingPractice | 11 | 577 | # Given a string containing just the characters '(', ')', '{', '}', '[' and ']',
# determine if the input string is valid.
# An input string is valid if:
# Open brackets must be closed by the same type of brackets.
# Open brackets must be closed in the correct order.
# Note that an empty string is also considered val... | 4.21875 | 4 |
backend/ibutsu_server/controllers/health_controller.py | rsnyman/ibutsu-server | 10 | 578 | <filename>backend/ibutsu_server/controllers/health_controller.py
from flask import current_app
from sqlalchemy.exc import InterfaceError
from sqlalchemy.exc import OperationalError
try:
from ibutsu_server.db.model import Result
IS_CONNECTED = True
except ImportError:
IS_CONNECTED = False
def get_health(... | 2.640625 | 3 |
src/python/tsnecuda/TSNE.py | rappdw/tsne-cuda | 1 | 579 | """Bindings for the Barnes Hut TSNE algorithm with fast nearest neighbors
Refs:
References
[1] <NAME>, L.J.P.; Hinton, G.E. Visualizing High-Dimensional Data
Using t-SNE. Journal of Machine Learning Research 9:2579-2605, 2008.
[2] <NAME>, L.J.P. t-Distributed Stochastic Neighbor Embedding
http://homepage.tudelft.nl/19... | 2.515625 | 3 |
school/admin/__init__.py | leyyin/university-SE | 3 | 580 | # contains any CRUD not related to strictly editing users info and courses info
from .views import admin
| 1 | 1 |
python/helpers/pydev/pydevd_file_utils.py | kirmerzlikin/intellij-community | 1 | 581 | <reponame>kirmerzlikin/intellij-community
r'''
This module provides utilities to get the absolute filenames so that we can be sure that:
- The case of a file will match the actual file in the filesystem (otherwise breakpoints won't be hit).
- Providing means for the user to make path conversions whe... | 2.421875 | 2 |
src/networking/SessionsManager.py | OfekHarel/Orion-Connection-Software | 1 | 582 | <gh_stars>1-10
import os
import socket
from random import randint
from src import Constants
from src.Constants import Network
from src.networking import NetworkPackets, Actions
from src.networking.Client import Client
from src.utils.DH_Encryption import Encryption
from src.utils.Enum import Enum
class SessionManager... | 2.5 | 2 |
influxdb_service_sdk/model/container/resource_requirements_pb2.py | easyopsapis/easyops-api-python | 5 | 583 | <filename>influxdb_service_sdk/model/container/resource_requirements_pb2.py
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: resource_requirements.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descript... | 1.335938 | 1 |
tests/test_http_client.py | bhch/async-stripe | 8 | 584 | from __future__ import absolute_import, division, print_function
import pytest
import json
import asyncio
import stripe
import urllib3
from stripe import six, util
from async_stripe.http_client import TornadoAsyncHTTPClient
pytestmark = pytest.mark.asyncio
VALID_API_METHODS = ("get", "post", "delete")
class Str... | 1.945313 | 2 |
http/static/jsonvis.py | cheeseywhiz/cheeseywhiz | 0 | 585 | <filename>http/static/jsonvis.py
"""\
Provides html file visualization of a json dataset
"""
import json
import subprocess
class JsonVis:
def _open_list(self):
self.instructions.append(('open_list', None))
def _list_item(self, data):
self.instructions.append(('list_item', str(data)))
def... | 3.203125 | 3 |
sim2d_game_analyzer/MainWindow.py | goncamateus/sim2d_game_analyzer | 1 | 586 | import sys
from PyQt5 import QtGui
from PyQt5.QtCore import QEvent, QPoint, Qt
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import (QApplication, QDialog, QGroupBox, QMainWindow,
QTabWidget, QVBoxLayout, QWidget)
from sim2d_game_analyzer.fmdb_tab import FMDBTab
class MainWindow(QM... | 2.328125 | 2 |
cmd/extractor.py | Grammarian/sicle | 0 | 587 | # pip install openpyxl
# pip install cuid
import os.path
import json
import datetime
from openpyxl import load_workbook
import cuid # https://github.com/necaris/cuid.py - create uuid's in the format that graphcool expects
SOURCE_XLSX = "./data/CLP_combined.xlsx"
EXTRACT_OUTPUT_DIR = "../server/extract"
SCHOOL_TITL... | 2.5 | 2 |
fHDHR/origin/origin_channels.py | crackers8199/fHDHR_USTVGO | 0 | 588 | import os
import sys
from lxml import html
import pathlib
import json
import m3u8
from seleniumwire import webdriver
from selenium.common.exceptions import TimeoutException, NoSuchElementException
from selenium.webdriver.firefox.options import Options as FirefoxOptions
IFRAME_CSS_SELECTOR = '.iframe-container>iframe'... | 2.140625 | 2 |
version.py | XioNoX/ansible-junos-stdlib-old | 0 | 589 | VERSION = "1.4.0"
DATE = "2016-Sept-21"
| 1.085938 | 1 |
Episode11-Menu/Pygame/explosion.py | Inksaver/Shmup_With_Pygame_Love2D_Monogame | 1 | 590 | <gh_stars>1-10
import pygame
import shared
class Explosion():
def __init__(self, images:list, centre:tuple, key:str) -> None:
''' Class variables. key: 'sm', 'lg', 'player '''
self.images = images # list of 8 images
self.centre = centre # use for all frames
self.key = key # key used later
... | 3 | 3 |
funcx_endpoint/funcx_endpoint/strategies/base.py | arokem/funcX | 1 | 591 | import sys
import threading
import logging
import time
logger = logging.getLogger("interchange.strategy.base")
class BaseStrategy(object):
"""Implements threshold-interval based flow control.
The overall goal is to trap the flow of apps from the
workflow, measure it and redirect it the appropriate execu... | 2.671875 | 3 |
hw3 cnn and vis/gradcam.py | mtang1001/ML-Exploration | 0 | 592 | import torch
import torchvision
import matplotlib
import matplotlib.pyplot as plt
from PIL import Image
from captum.attr import GuidedGradCam, GuidedBackprop
from captum.attr import LayerActivation, LayerConductance, LayerGradCam
from data_utils import *
from image_utils import *
from captum_utils import *
import nump... | 2.5625 | 3 |
src/genotypes.py | k8lion/admmdarts | 0 | 593 | <gh_stars>0
from collections import namedtuple
Genotype = namedtuple('Genotype', 'normal normal_concat reduce reduce_concat')
PRIMITIVES = [
'none',
'max_pool_3x3',
'avg_pool_3x3',
'skip_connect',
'sep_conv_3x3',
'sep_conv_5x5',
'dil_conv_3x3',
'dil_conv_5x5'
]
CRBPRIMITIVES = [
'... | 1.695313 | 2 |
colab_logica.py | smdesai/logica | 0 | 594 | <gh_stars>0
#!/usr/bin/python
#
# Copyright 2020 Google LLC
#
# 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 applicab... | 2.125 | 2 |
pyccel/ast/basic.py | toddrme2178/pyccel | 0 | 595 | from sympy.core.basic import Basic as sp_Basic
class Basic(sp_Basic):
"""Basic class for Pyccel AST."""
_fst = None
def set_fst(self, fst):
"""Sets the redbaron fst."""
self._fst = fst
@property
def fst(self):
return self._fst
| 2.453125 | 2 |
alibi_detect/utils/tests/test_discretize.py | Clusks/alibi-detect | 1,227 | 596 | from itertools import product
import numpy as np
import pytest
from alibi_detect.utils.discretizer import Discretizer
x = np.random.rand(10, 4)
n_features = x.shape[1]
feature_names = [str(_) for _ in range(n_features)]
categorical_features = [[], [1, 3]]
percentiles = [list(np.arange(25, 100, 25)), list(np.arange(10... | 2.0625 | 2 |
tinc/tests/parameter_space_test.py | AlloSphere-Research-Group/tinc-python | 1 | 597 | # -*- coding: utf-8 -*-
"""
Created on Mon Jun 14 11:49:43 2021
@author: Andres
"""
import sys,time
import unittest
from tinc import *
class ParameterSpaceTest(unittest.TestCase):
def test_parameter(self):
p1 = Parameter("param1")
p2 = Parameter("param2")
ps = ParameterSpace("ps")
... | 2.9375 | 3 |
interpretable_ddts/runfiles/gym_runner.py | CORE-Robotics-Lab/Interpretable_DDTS_AISTATS2020 | 5 | 598 | # Created by <NAME> on 8/28/19
import gym
import numpy as np
import torch
from interpretable_ddts.agents.ddt_agent import DDTAgent
from interpretable_ddts.agents.mlp_agent import MLPAgent
from interpretable_ddts.opt_helpers.replay_buffer import discount_reward
import torch.multiprocessing as mp
import argparse
import c... | 2.21875 | 2 |
Week 08/tw10_words_by_prefix.py | andrewn488/OMSBA-5061 | 0 | 599 | """ TW10: Words by Prefix
Team: <NAME>, <NAME>
For: OMSBA 2061, Seattle University
Date: 11/3/2020
"""
def wordByPrefix(prefix_length, word):
my_dict = {}
for key in word:
for letter in word:
prefix_key = letter[:prefix_length]
letter = word[:prefix_length]
... | 3.515625 | 4 |