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 |
|---|---|---|---|---|---|---|
hermetrics/damerau_levenshtein.py | SoldAI/hermetrics | 3 | 7600 | <filename>hermetrics/damerau_levenshtein.py
from .levenshtein import Levenshtein
class DamerauLevenshtein(Levenshtein):
def __init__(self, name='Damerau-Levenshtein'):
super().__init__(name=name)
def distance(self, source, target, cost=(1, 1, 1, 1)):
"""Damerau-Levenshtein distance with c... | 3.390625 | 3 |
etna/analysis/outliers/hist_outliers.py | Carlosbogo/etna | 1 | 7601 | <reponame>Carlosbogo/etna
import typing
from copy import deepcopy
from typing import TYPE_CHECKING
from typing import List
import numba
import numpy as np
import pandas as pd
if TYPE_CHECKING:
from etna.datasets import TSDataset
@numba.jit(nopython=True)
def optimal_sse(left: int, right: int, p: np.ndarray, pp:... | 2.78125 | 3 |
aws/securityGroup.py | emanueleleyland/sabd-project2 | 0 | 7602 | def createKafkaSecurityGroup(ec2, vpc):
sec_group_kafka = ec2.create_security_group(
GroupName='kafka', Description='kafka sec group', VpcId=vpc.id)
sec_group_kafka.authorize_ingress(
IpPermissions=[{'IpProtocol': 'icmp', 'FromPort': -1, 'ToPort': -1, 'IpRanges': [{'CidrIp': '0.0.0.0/0'}]},
... | 2 | 2 |
virtual/lib/python3.6/site-packages/django_pusher/context_processors.py | petermirithu/hooby_lab | 2 | 7603 | <gh_stars>1-10
from django.conf import settings
def pusher(request):
return {
"PUSHER_KEY": getattr(settings, "PUSHER_KEY", ""),
}
| 1.671875 | 2 |
inconnu/character/update/parse.py | tiltowait/inconnu | 4 | 7604 | <reponame>tiltowait/inconnu
"""character/update/parse.py - Defines an interface for updating character traits."""
# pylint: disable=too-many-arguments
import re
import discord
from discord_ui.components import LinkButton
from . import paramupdate
from ..display import display
from ... import common, constants
from .... | 2.46875 | 2 |
src/models/train_search_multi_deep.py | smadha/MlTrio | 0 | 7605 | '''
Uses flattened features in feature directory and run a SVM on it
'''
from keras.layers import Dense
from keras.models import Sequential
import keras.regularizers as Reg
from keras.optimizers import SGD, RMSprop
from keras.callbacks import EarlyStopping
import cPickle as pickle
import numpy as np
from sklearn.model... | 2.921875 | 3 |
formation.py | graham-kim/pygremlin-graph-visualiser | 0 | 7606 | <filename>formation.py
import sys
import os
sys.path.append( os.path.dirname(__file__) )
import numpy as np
import typing as tp
import angles
from model import Node, Link, Label
from spec import ArrowDraw, NodeSpec
class FormationManager:
def __init__(self):
self._nodes = {}
self._links = []
... | 2.65625 | 3 |
opencv_camera/parameters/utils.py | MomsFriendlyRobotCompany/opencv_camera | 6 | 7607 | ##############################################
# The MIT License (MIT)
# Copyright (c) 2014 <NAME>
# see LICENSE for full details
##############################################
# -*- coding: utf-8 -*
from math import atan, pi
def fov(w,f):
"""
Returns the FOV as in degrees, given:
w: image... | 2.796875 | 3 |
Code_Hybrid_SLIMBPR_CBF_RP3Beta.py | SamanFekri/BookRecommendation | 0 | 7608 | # This Python 3 environment comes with many helpful analytics libraries installed
# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python
# For example, here's several helpful packages to load
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g... | 2.34375 | 2 |
dodge/config.py | MoyTW/7DRL2016_Rewrite | 2 | 7609 | <gh_stars>1-10
import json
class Config(object):
def __init__(self, file_location):
with open(file_location, 'r') as f:
config = json.load(f)
self.SCREEN_WIDTH = int(config["SCREEN_WIDTH"])
self.SCREEN_HEIGHT = int(config["SCREEN_HEIGHT"])
self.MAP_WIDTH = i... | 2.6875 | 3 |
incal_lib/create_dataframe.py | barel-mishal/InCal_lib | 0 | 7610 | <reponame>barel-mishal/InCal_lib
import pandas as pd
import numpy as np
def create_calr_example_df(n_rows, start_date):
'''
'''
np.random.seed(20)
array = np.random.rand(n_rows)
cumulative = np.cumsum(array)
d = {
'feature1_subject_1': array,
'feature1_subject_2': array,
... | 2.921875 | 3 |
HybridSN/DataLoadAndOperate.py | lms-07/HybridSN | 0 | 7611 | import os
import numpy as np
import scipy.io as sio
import tifffile
from sklearn.decomposition import PCA
from sklearn.model_selection import train_test_split
#Load dataset
def loadData(name,data_path):
if name == 'IP':
data = sio.loadmat(os.path.join(data_path, 'Indian_pines_corrected.mat'))['indian_pin... | 2.484375 | 2 |
alipay/aop/api/domain/AlipayOpenIotmbsDooropenresultSyncModel.py | antopen/alipay-sdk-python-all | 0 | 7612 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AlipayOpenIotmbsDooropenresultSyncModel(object):
def __init__(self):
self._dev_id = None
self._door_state = None
self._project_id = None
@property
def dev_id(self... | 1.984375 | 2 |
setup.py | ghost58400/marlin-binary-protocol | 0 | 7613 | import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="marlin_binary_protocol",
version="0.0.7",
author="<NAME>",
author_email="<EMAIL>",
description="Transfer files with Marlin 2.0 firmware using Marlin Binary Protocol Mark II",
long_desc... | 1.421875 | 1 |
taut_euler_class.py | henryseg/Veering | 2 | 7614 | <reponame>henryseg/Veering
#
# taut_euler_class.py
#
from file_io import parse_data_file, write_data_file
from taut import liberal, isosig_to_tri_angle
from transverse_taut import is_transverse_taut
from sage.matrix.constructor import Matrix
from sage.modules.free_module_element import vector
from sage.arith.misc im... | 2.15625 | 2 |
mailing/urls.py | ananyamalik/Railway-Concession-Portal | 0 | 7615 | <filename>mailing/urls.py
from django.urls import path
from .views import ( student_list, student_add, student_profile,student_delete )
| 1.523438 | 2 |
transformers/tests/tokenization_xlnet_test.py | deepbluesea/transformers | 270 | 7616 | # coding=utf-8
# Copyright 2018 The Google AI Language Team 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/LICENSE-2.0
#
# Unless required by ... | 2.265625 | 2 |
preprocess/utils/liftOver_vcf.py | Rongtingting/xcltk | 0 | 7617 | # forked from https://github.com/single-cell-genetics/cellSNP
## A python wrap of UCSC liftOver function for vcf file
## UCSC liftOver binary and hg19 to hg38 chain file:
## https://genome.ucsc.edu/cgi-bin/hgLiftOver
## http://hgdownload.cse.ucsc.edu/admin/exe/linux.x86_64/liftOver
## http://hgdownload.soe.ucsc.edu/gol... | 2.375 | 2 |
pomodorr/frames/tests/test_consumers.py | kamil559/pomodorr | 0 | 7618 | <filename>pomodorr/frames/tests/test_consumers.py
import json
import pytest
from channels.db import database_sync_to_async
from channels.testing import WebsocketCommunicator
from pytest_lazyfixture import lazy_fixture
from pomodorr.frames import statuses
from pomodorr.frames.models import DateFrame
from pomodorr.fram... | 2.078125 | 2 |
Bot/db_aps.py | FaHoLo/Fish_shop | 0 | 7619 | import logging
import os
import redis
import moltin_aps
_database = None
db_logger = logging.getLogger('db_logger')
async def get_database_connection():
global _database
if _database is None:
database_password = os.getenv('DB_PASSWORD')
database_host = os.getenv('DB_HOST')
databas... | 2.171875 | 2 |
backend/server/tables/__init__.py | shiv12095/realtimeviz | 1 | 7620 | from .lime_bike_feed import LimeBikeFeed
from .lime_bike_trips import LimeBikeTrips
from .lime_bike_trips_analyze import LimeBikeTripsAnalyze
| 1.039063 | 1 |
sapmon/payload/provider/sapnetweaver.py | gummadirajesh/AzureMonitorForSAPSolutions | 0 | 7621 | # Python modules
import json
import logging
from datetime import datetime, timedelta, timezone
from time import time
from typing import Any, Callable
import re
import requests
from requests import Session
from threading import Lock
# SOAP Client modules
from zeep import Client
from zeep import helpers
from zeep.transp... | 1.726563 | 2 |
docker_squash/version.py | pombredanne/docker-scripts | 513 | 7622 | <reponame>pombredanne/docker-scripts
version = "1.0.10.dev0"
| 0.882813 | 1 |
example_usage/example_list_errors.py | oceanprotocol/plecos | 1 | 7623 | from pathlib import Path
import plecos
import json
print(plecos.__version__)
#%%
path_to_json_local = Path("~/ocn/plecos/plecos/samples/sample_metadata_local.json").expanduser()
path_to_json_remote = Path("~/ocn/plecos/plecos/samples/sample_metadata_remote.json").expanduser()
path_to_broken_json = Path("~/ocn/plecos/pl... | 2.234375 | 2 |
pangloss/backend.py | CLRafaelR/pangloss | 0 | 7624 | <gh_stars>0
import re
import panflute as pf
from functools import partial
from pangloss.util import smallcapify, break_plain
# regular expression for label formats
label_re = re.compile(r'\{#ex:(\w+)\}')
gb4e_fmt_labelled = """
\\ex\\label{{ex:{label}}}
\\gll {} \\\\
{} \\\\
\\trans {}
"""
gb4e_fmt = """
\\ex
\\gl... | 2.59375 | 3 |
tests/unit/discovery/test_py_spec.py | xavfernandez/virtualenv | 1 | 7625 | from __future__ import absolute_import, unicode_literals
import itertools
import os
import sys
from copy import copy
import pytest
from virtualenv.discovery.py_spec import PythonSpec
def test_bad_py_spec():
text = "python2.3.4.5"
spec = PythonSpec.from_string_spec(text)
assert text in repr(spec)
as... | 2.1875 | 2 |
plugins/module_utils/definitions/trigger_image_activation.py | robertcsapo/dnacenter-ansible | 0 | 7626 | from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
module_definition = json.loads(
"""{
"family": "software_image_management_swim",
"name": "trigger_image_activation",
"operations": {
"post": [
"trigger_software_image_activation"
... | 2.09375 | 2 |
minecraft_launcher_lib/fabric.py | bopchik/Simple-minecraft-mod-launcher | 1 | 7627 | <filename>minecraft_launcher_lib/fabric.py
from .helper import download_file, get_user_agent
from .install import install_minecraft_version
from typing import List, Dict, Union
from xml.dom import minidom
import subprocess
import requests
import tempfile
import random
import os
def get_all_minecraft_versions() -> List... | 2.703125 | 3 |
Strand Sort.py | Nishkarsh-Tripathi/Sorting-algorithms- | 5 | 7628 | # STRAND SORT
# It is a recursive comparison based sorting technique which sorts in increasing order.
# It works by repeatedly pulling sorted sub-lists out of the list to be sorted and merging them
# with a result array.
# Algorithm:
# Create a empty strand (list) and append the first element to it popping it from th... | 4.46875 | 4 |
gamestonk_terminal/cryptocurrency/overview/pycoingecko_model.py | minhhoang1023/GamestonkTerminal | 0 | 7629 | """CoinGecko model"""
__docformat__ = "numpy"
# pylint: disable=C0301, E1101
import logging
import re
from typing import Any, List
import numpy as np
import pandas as pd
from pycoingecko import CoinGeckoAPI
from gamestonk_terminal.cryptocurrency.dataframe_helpers import (
create_df_index,
long_number_format... | 2.140625 | 2 |
docker/messein/board-import-app/app.py | sourceperl/tk-dashboard | 0 | 7630 | <filename>docker/messein/board-import-app/app.py
#!/usr/bin/env python3
from configparser import ConfigParser
from datetime import datetime
import urllib.parse
import hashlib
import io
import json
import logging
import os
import re
import time
from xml.dom import minidom
import feedparser
import requests
import schedu... | 1.726563 | 2 |
fsleyes_widgets/widgetlist.py | pauldmccarthy/fsleyes-widgets | 1 | 7631 | <filename>fsleyes_widgets/widgetlist.py
#!/usr/bin/env python
#
# widgetlist.py - A widget which displays a list of groupable widgets.
#
# Author: <NAME> <<EMAIL>>
#
"""This module provides the :class:`WidgetList` class, which displays a list
of widgets.
"""
import wx
import wx.lib.newevent as wxevent
import wx.... | 3.109375 | 3 |
setup.py | TransactPRO/gw3-python-client | 1 | 7632 | #!/usr/bin/env python
import setuptools
MAINTAINER_NAME = '<NAME>'
MAINTAINER_EMAIL = '<EMAIL>'
URL_GIT = 'https://github.com/TransactPRO/gw3-python-client'
try:
import pypandoc
LONG_DESCRIPTION = pypandoc.convert('README.md', 'rst')
except (IOError, ImportError, OSError, RuntimeError):
LONG_DESCRIPTION... | 1.328125 | 1 |
social_auth_mitxpro/backends_test.py | mitodl/social-auth-mitxpro | 0 | 7633 | <filename>social_auth_mitxpro/backends_test.py
"""Tests for our backend"""
from urllib.parse import urljoin
import pytest
from social_auth_mitxpro.backends import MITxProOAuth2
# pylint: disable=redefined-outer-name
@pytest.fixture
def strategy(mocker):
"""Mock strategy"""
return mocker.Mock()
@pytest.f... | 2.421875 | 2 |
Scripts/simulation/careers/detective/detective_crime_scene.py | velocist/TS4CheatsInfo | 0 | 7634 | # uncompyle6 version 3.7.4
# Python bytecode 3.7 (3394)
# Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
# Embedded file name: T:\InGame\Gameplay\Scripts\Server\careers\detective\detective_crime_scene.py
# Compiled at: 2015-02-08 03:00:54
# Size of source mod 2... | 1.945313 | 2 |
classifier/interpretation_exp.py | methylgrammarlab/proj_scwgbs | 0 | 7635 | <reponame>methylgrammarlab/proj_scwgbs
"""
Code adapted from https://github.com/ohlerlab/DeepRiPe with changes
Extract information and graphs from the Integrated gradients output
"""
import argparse
import os
import sys
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from classifier.plotseql... | 2.53125 | 3 |
scripts/pythonutils/autorepr.py | shulinye/dotfiles | 2 | 7636 | <reponame>shulinye/dotfiles<filename>scripts/pythonutils/autorepr.py
#!/usr/bin/python3
from collections import OrderedDict
from functools import partial
from ordered_set import OrderedSet
import inspect
import itertools
import types
from .utils import walk_getattr
__all__ = ['autoinit', 'autorepr', 'TotalCompareByK... | 2.40625 | 2 |
v1.0.0.test/toontown/estate/DistributedGardenPlotAI.py | TTOFFLINE-LEAK/ttoffline | 4 | 7637 | <filename>v1.0.0.test/toontown/estate/DistributedGardenPlotAI.py<gh_stars>1-10
from direct.directnotify import DirectNotifyGlobal
from toontown.estate import GardenGlobals
from toontown.estate.DistributedLawnDecorAI import DistributedLawnDecorAI
FLOWER_X_OFFSETS = (
None, (0, ), (-1.5, 1.5), (-3.4, 0, 3.5))
class Dis... | 2.15625 | 2 |
python/handwritten_baseline/pipeline/model/feature_extr/debug.py | UKPLab/cdcr-beyond-corpus-tailored | 10 | 7638 | import pprint
from typing import Optional, List, Tuple, Set, Dict
import numpy as np
from overrides import overrides
from python.handwritten_baseline.pipeline.data.base import Dataset
from python.handwritten_baseline.pipeline.model.feature_extr import DEBUG_EXTR
from python.handwritten_baseline.pipeline.model.feature... | 2.328125 | 2 |
kunquat/tracker/errorbase.py | cyberixae/kunquat | 0 | 7639 | # -*- coding: utf-8 -*-
#
# Author: <NAME>, Finland 2014
#
# This file is part of Kunquat.
#
# CC0 1.0 Universal, http://creativecommons.org/publicdomain/zero/1.0/
#
# To the extent possible under law, Kunquat Affirmers have waived all
# copyright and related or neighboring rights to Kunquat.
#
from __future__ import... | 1.929688 | 2 |
venv/lib/python3.5/site-packages/igraph/test/atlas.py | dtklinh/Protein-Rigid-Domains-Estimation | 2 | 7640 | <reponame>dtklinh/Protein-Rigid-Domains-Estimation
import warnings
import unittest
from igraph import *
class TestBase(unittest.TestCase):
def testPageRank(self):
for idx, g in enumerate(self.__class__.graphs):
try:
pr = g.pagerank()
except Exception as ex:
... | 2.421875 | 2 |
pycspr/types/cl.py | momipsl/pycspr | 2 | 7641 | import dataclasses
import enum
class CLType(enum.Enum):
"""Enumeration over set of CL types.
"""
BOOL = 0
I32 = 1
I64 = 2
U8 = 3
U32 = 4
U64 = 5
U128 = 6
U256 = 7
U512 = 8
UNIT = 9
STRING = 10
KEY = 11
UREF = 12
OPTION = 13
LIST = 14
BYTE_A... | 2.78125 | 3 |
google/cloud/aiplatform_v1/types/env_var.py | nachocano/python-aiplatform | 0 | 7642 | # -*- coding: utf-8 -*-
# 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 applicable law o... | 1.9375 | 2 |
tools/borplay/packlib.py | MrCoolSpan/openbor | 25 | 7643 | <filename>tools/borplay/packlib.py<gh_stars>10-100
# Copyright (c) 2009 <NAME> ("Plombo")
# Class and functions to read .PAK files.
import struct
from cStringIO import StringIO
class PackFileReader(object):
''' Represents a BOR packfile. '''
files = dict() # the index holding the location of each file
... | 2.96875 | 3 |
artascope/src/web/app.py | magus0219/icloud-photo-downloader | 3 | 7644 | <filename>artascope/src/web/app.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Created by magus0219[<EMAIL>] on 2020/3/23
from types import FunctionType
from flask import (
Flask,
redirect,
url_for,
)
import artascope.src.web.lib.filter as module_filter
from artascope.src.web.lib.content_processor im... | 1.71875 | 2 |
tests/common/test_op/scatter_nd.py | KnowingNothing/akg-test | 1 | 7645 | <filename>tests/common/test_op/scatter_nd.py
# Copyright 2019 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
#
# U... | 2.265625 | 2 |
spc/backend_utils.py | adamnew123456/spc | 1 | 7646 | """
Utility functions and classes shared by multiple backends
"""
from collections import namedtuple
import logging
from . import symbols
from . import types
LOGGER = logging.getLogger('spc.backend_utils')
# NameContexts encapsulate both the function stack (which holds values) and
# the symbol table context (which b... | 2.5625 | 3 |
heareval/__init__.py | neuralaudio/hear-eval-kit | 24 | 7647 | __version__ = "2021.0.6"
| 1.054688 | 1 |
recommender_engine/similarity_measure/__init__.py | tranlyvu/recommender | 8 | 7648 | """
recommender_engine
-----
recommender_engine is a recommendation application using either item-based or user-based approaches
:copyright: (c) 2016 - 2019 by <NAME>. All Rights Reserved.
:license: Apache License 2.0
"""
from .cosine import cosine
from .euclidean_distance import euclidean_distance
from .pears... | 1.585938 | 2 |
code/abc057_a_02.py | KoyanagiHitoshi/AtCoder | 3 | 7649 | a,b=map(int,input().split())
print((a+b)%24) | 2.34375 | 2 |
8/8_9.py | kopsh/python_cookbook | 0 | 7650 | <filename>8/8_9.py
class CheckType:
r"""
8.9 创建新的类或实例属性
使用描述器,实现参数类型检查
>>> @ParamAssert(a=int, b=list)
... class A:
... def __init__(self, a, b):
... self.a = a
... self.b = b
>>> a = A(1, [])
"""
def __init__(self, name, expected_type):
self.name... | 3.375 | 3 |
test/examples/test_simple_gp_regression.py | ediphy-dwild/gpytorch | 0 | 7651 | import math
import torch
import unittest
import gpytorch
from torch import optim
from torch.autograd import Variable
from gpytorch.kernels import RBFKernel
from gpytorch.means import ConstantMean
from gpytorch.likelihoods import GaussianLikelihood
from gpytorch.random_variables import GaussianRandomVariable
# Simple ... | 2.578125 | 3 |
samples/RiskManagement/Verification/customer-match-denied-parties-list.py | snavinch/cybersource-rest-samples-python | 21 | 7652 | from CyberSource import *
import os
import json
from importlib.machinery import SourceFileLoader
config_file = os.path.join(os.getcwd(), "data", "Configuration.py")
configuration = SourceFileLoader("module.name", config_file).load_module()
# To delete None values in Input Request Json body
def del_none(d):
for ke... | 2.421875 | 2 |
SimulatePi.py | Lucchese-Anthony/MonteCarloSimulation | 0 | 7653 | <filename>SimulatePi.py
import numpy as np
import random
import math
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from matplotlib import style
angle = np.linspace( 0 , 2 * np.pi , 150)
radius = 1
x = radius * np.cos(angle)
y = radius * np.sin(angle)
#prints the circle
style.use('fivet... | 3.734375 | 4 |
run.py | aarvanitii/adminWebsite | 0 | 7654 | """
This is where the web application starts running
"""
from app.index import create_app
app = create_app()
if __name__ == "__main__":
app.secret_key = 'mysecret'
app.run(port=8080, host="0.0.0.0", debug=True) | 1.960938 | 2 |
tareas/3/GarciaFigueroaAlberto-GarciaEdgar/Proceso.py | jorgelmp/sistop-2022-1 | 6 | 7655 | class Proceso:
def __init__(self,tiempo_de_llegada,t,id):
self.t=t
self.tiempo_de_llegada=tiempo_de_llegada
self.id=id
self.inicio=0
self.fin=0
self.T=0
self.E=0
self.P=0
self.tRestantes = t
| 2.75 | 3 |
Algo and DSA/LeetCode-Solutions-master/Python/smallest-greater-multiple-made-of-two-digits.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 7656 | # Time: sum(O(l * 2^l) for l in range(1, 11)) = O(20 * 2^10) = O(1)
# Space: O(1)
class Solution(object):
def findInteger(self, k, digit1, digit2):
"""
:type k: int
:type digit1: int
:type digit2: int
:rtype: int
"""
MAX_NUM_OF_DIGITS = 10
INT_MAX = ... | 3.234375 | 3 |
aldryn_people/tests/test_plugins.py | compoundpartners/js-people | 0 | 7657 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
try:
from django.core.urlresolvers import reverse
except ImportError:
# Django 2.0
from django.urls import reverse
from django.utils.translation import force_text
from cms import api
from cms.utils.i18n import force_language
from aldryn_peop... | 2.328125 | 2 |
turbo_transformers/python/tests/__init__.py | xcnick/TurboTransformers | 1,147 | 7658 | <gh_stars>1000+
# Copyright (C) 2020 THL A29 Limited, a Tencent company.
# All rights reserved.
# Licensed under the BSD 3-Clause License (the "License"); you may
# not use this file except in compliance with the License. You may
# obtain a copy of the License at
# https://opensource.org/licenses/BSD-3-Clause
# Unless ... | 0.886719 | 1 |
generate_joke.py | audreymychan/djsmile | 5 | 7659 | # This script contains the get_joke() function to generate a new dad joke
import requests
def get_joke():
"""Return new joke string from icanhazdadjoke.com."""
url = "https://icanhazdadjoke.com/"
response = requests.get(url, headers={'Accept': 'application/json'})
raw_joke = response.json()
joke ... | 3.078125 | 3 |
bot/tests/test_triggers/__init__.py | elihschiff/Rubber-Duck-Python | 7 | 7660 | from .test_commands import all_commands
all_triggers = all_commands
from .test_quack import TestQuack
all_triggers.append(TestQuack)
| 1.195313 | 1 |
src/main/scripts/crassus_deployer_lambda.py | Scout24/crassus | 0 | 7661 | <reponame>Scout24/crassus
from __future__ import print_function
from crassus import Crassus
from crassus.output_converter import OutputConverter
def handler(event, context):
crassus = Crassus(event, context)
crassus.deploy()
def cfn_output_converter(event, context):
"""
Convert an AWS CloudFormation... | 2.328125 | 2 |
Exareme-Docker/src/exareme/exareme-tools/madis/src/lib/pyreadline/clipboard/__init__.py | tchamabe1979/exareme | 0 | 7662 | import sys
success = False
in_ironpython = "IronPython" in sys.version
if in_ironpython:
try:
from ironpython_clipboard import GetClipboardText, SetClipboardText
success = True
except ImportError:
pass
else:
try:
from win32_clipboard import GetClipboardText, SetClipboardTex... | 2.46875 | 2 |
mjrl/utils/train_agent.py | YujieLu10/tslam | 0 | 7663 | import logging
logging.disable(logging.CRITICAL)
import math
from tabulate import tabulate
from mjrl.utils.make_train_plots import make_train_plots
from mjrl.utils.gym_env import GymEnv
from mjrl.samplers.core import sample_paths
import numpy as np
import torch
import pickle
import imageio
import time as timer
import o... | 1.84375 | 2 |
src/tests/plugins/banktransfer/test_refund_export.py | NicsTr/pretix | 0 | 7664 | <gh_stars>0
import json
from datetime import timedelta
from decimal import Decimal
import pytest
from django.utils.timezone import now
from pretix.base.models import Event, Order, OrderRefund, Organizer, Team, User
from pretix.plugins.banktransfer.models import RefundExport
from pretix.plugins.banktransfer.views impo... | 1.78125 | 2 |
datawinners/alldata/urls.py | ICT4H/dcs-web | 1 | 7665 | <gh_stars>1-10
# vim: ai ts=4 sts=4 et sw=4 encoding=utf-8
from django.conf.urls.defaults import patterns, url
from datawinners.alldata.views import get_entity_list_by_type
from datawinners.alldata.views import smart_phone_instruction
from datawinners.alldata.views import index, reports
from datawinners.alldata.views ... | 1.765625 | 2 |
NewLifeUtils/LoggerModule.py | NewLife1324/NewLifeUtils-Dev | 2 | 7666 | <gh_stars>1-10
from NewLifeUtils.ColorModule import ACC, MCC
from NewLifeUtils.UtilsModule import hex_to_rgb
from NewLifeUtils.FileModule import DataStorage, LogFile
from NewLifeUtils.StringUtilModule import remove_csi
from datetime import datetime
import sys
class Formatter(dict):
def __init__(self, *args, date_... | 2.359375 | 2 |
config/api_urls.py | elcolie/battleship | 0 | 7667 | <reponame>elcolie/battleship<filename>config/api_urls.py
from rest_framework import routers
from boards.api.viewsets import BoardViewSet
from fleets.api.viewsets import FleetViewSet
from missiles.api.viewsets import MissileViewSet
app_name = 'api'
router = routers.DefaultRouter()
router.register(r'boards', BoardView... | 1.976563 | 2 |
mealpy/evolutionary_based/MA.py | Alhassan20/mealpy | 1 | 7668 | <filename>mealpy/evolutionary_based/MA.py<gh_stars>1-10
#!/usr/bin/env python
# ------------------------------------------------------------------------------------------------------%
# Created by "<NAME>" at 14:22, 11/04/2020 %
# ... | 2.3125 | 2 |
src/estimagic/estimation/estimate_ml.py | OpenSourceEconomics/estimagic | 83 | 7669 | from estimagic.inference.ml_covs import cov_cluster_robust
from estimagic.inference.ml_covs import cov_hessian
from estimagic.inference.ml_covs import cov_jacobian
from estimagic.inference.ml_covs import cov_robust
from estimagic.inference.ml_covs import cov_strata_robust
from estimagic.inference.shared import calculat... | 2.09375 | 2 |
neural_architecture_search_appendix_a.py | NunoEdgarGFlowHub/neural_architecture_search_with_reinforcement_learning_appendix_a | 68 | 7670 | import six
import chainer
import numpy as np
import chainer.links as L
import chainer.functions as F
import nutszebra_chainer
import functools
from collections import defaultdict
class Conv(nutszebra_chainer.Model):
def __init__(self, in_channel, out_channel, filter_size=(3, 3), stride=(1, 1), pad=(1, 1)):
... | 2.46875 | 2 |
test/test_proportions_delta.py | quizlet/abracadabra | 24 | 7671 | <reponame>quizlet/abracadabra
import pytest
from abra import Experiment, HypothesisTest
def test_large_proportions_delta_expermiment(proportions_data_large):
exp = Experiment(proportions_data_large, name='proportions-test')
# run 'A/A' test
test_aa = HypothesisTest(
metric='metric',
contr... | 2.84375 | 3 |
src/bootils/plugins/core/jsw.py | Build-The-Web/bootils | 3 | 7672 | # -*- coding: utf-8 -*-
# pylint: disable=
""" Tanuki Java Service Wrapper runtime environment.
Debian JSW paths (Wheezy 3.5.3; Jessie 3.5.22)::
/usr/sbin/wrapper – ELF executable
/usr/share/wrapper/daemon.sh
/usr/share/wrapper/make-wrapper-init.sh
/usr/share/wrapper/wrapper.conf
"... | 1.8125 | 2 |
MachineLearning/hw1/models/LinearRegression.py | ChoKyuWon/SchoolProjects | 0 | 7673 | import numpy as np
class LinearRegression:
def __init__(self, num_features):
self.num_features = num_features
self.W = np.zeros((self.num_features, 1))
def train(self, x, y, epochs, batch_size, lr, optim):
final_loss = None # loss of final epoch
# Training should b... | 3.03125 | 3 |
apps/bc_scraper/actions/schedule.py | aurmeneta/ramos-uc | 7 | 7674 | <reponame>aurmeneta/ramos-uc<filename>apps/bc_scraper/actions/schedule.py
from copy import copy
DEFAULT_SCHEDULE = {}
for day in "lmwjvs":
for mod in "12345678":
DEFAULT_SCHEDULE[day + mod] = "'FREE'"
def process_schedule(text_sc):
"""For a given schedule text in BC format, returns the SQL queries f... | 2.75 | 3 |
openstack_dashboard/dashboards/admin/volumes/views.py | NunoEdgarGFlowHub/horizon | 1 | 7675 | # Copyright 2012 Nebula, 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.0
#
# Unless required by applicable law or agree... | 1.695313 | 2 |
tests/__init__.py | flowolf/yessssms | 6 | 7676 | """Tests for YesssSMS."""
| 1.125 | 1 |
bldr/dep/env.py | bldr-cmd/bldr-cmd | 0 | 7677 | <filename>bldr/dep/env.py<gh_stars>0
# This is used by Environment to populate its env
# Due to circular dependencies it cannot reference other parts of bldr
import toml
def default(dotbldr_path: str) -> dict:
dep = {
'config': toml.load(f"{dotbldr_path}/dependency.toml"),
'lock': toml.load(f"{dotb... | 2.203125 | 2 |
rasa-sample/actions.py | ijufumi/demo-python | 0 | 7678 | import re
from typing import Any, Text, Dict, List
from rasa_sdk import Action, Tracker
from rasa_sdk.executor import CollectingDispatcher
from rasa_sdk.events import SlotSet
import lark_module
class ActionHelloWorld(Action):
state_map = {}
def name(self) -> Text:
return "action_hello_world"
d... | 2.25 | 2 |
parsers/politico.py | plympton/newsdiffs | 0 | 7679 | <reponame>plympton/newsdiffs
from baseparser import BaseParser, grab_url, logger
# Different versions of BeautifulSoup have different properties.
# Some work with one site, some with another.
# This is BeautifulSoup 3.2.
from BeautifulSoup import BeautifulSoup
# This is BeautifulSoup 4
import bs4
class PoliticoParse... | 2.546875 | 3 |
integration-tests/bats/server_multiclient_test.py | fairhopeweb/dolt | 2 | 7680 | <filename>integration-tests/bats/server_multiclient_test.py
import os
import sys
from queue import Queue
from threading import Thread
from helper.pytest import DoltConnection
# Utility functions
def print_err(e):
print(e, file=sys.stderr)
def query(dc, query_str):
return dc.query(query_str, False)
def qu... | 1.96875 | 2 |
messenger/client/messenger.py | marik348/python-messenger | 2 | 7681 | from requests import get, post, exceptions
from datetime import datetime
from PyQt5 import QtWidgets, QtCore
from PyQt5.QtWidgets import QMessageBox
from PyQt5.QtGui import QFont
from qtwidgets import PasswordEdit
from client_commands import (help_client, online, status, myself, reg, role, ban, unban)
from client_con... | 2.53125 | 3 |
oscar/lib/python2.7/site-packages/prompt_toolkit/utils.py | sainjusajan/django-oscar | 0 | 7682 | <gh_stars>0
from __future__ import unicode_literals
import inspect
import os
import signal
import sys
import threading
import weakref
from wcwidth import wcwidth
from six.moves import range
__all__ = (
'Event',
'DummyContext',
'get_cwidth',
'suspend_to_background_supported',
'is_... | 2.234375 | 2 |
lmdb/cffi.py | hirnimeshrampuresoftware/py-lmdb | 185 | 7683 | <reponame>hirnimeshrampuresoftware/py-lmdb
#
# Copyright 2013 The py-lmdb authors, all rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted only as authorized by the OpenLDAP
# Public License.
#
# A copy of this license is available in the file LICENSE in... | 1.476563 | 1 |
.virtual_documents/00_core.ipynb.py | AtomScott/image_folder_datasets | 0 | 7684 | <gh_stars>0
# default_exp core
#hide
from nbdev.showdoc import *
from fastcore.test import *
# export
import os
import torch
from torch import nn
from torch.nn import functional as F
from torch.utils.data import DataLoader
import warnings
import torchvision
from torchvision.datasets import MNIST, ImageFolder
from... | 1.867188 | 2 |
src/modules/iam/module.py | pgorecki/python-ddd | 10 | 7685 | from seedwork.application.modules import BusinessModule
from modules.iam.application.services import AuthenticationService
class IdentityAndAccessModule(BusinessModule):
def __init__(self, authentication_service: AuthenticationService):
self.authentication_service = authentication_service
# @staticm... | 2.359375 | 2 |
test_scripts/pyfora2/containerTests.py | ufora/ufora | 571 | 7686 | # Copyright 2015 Ufora 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.0
#
# Unless required by applicable law or agreed to i... | 1.6875 | 2 |
src/utils/torch_common.py | quochungto/SIIM-COVID19-Detection | 0 | 7687 | import os
import gc
import random
import numpy as np
import torch
def seed_everything(seed):
os.environ['PYTHONHASHSEED'] = str(seed)
random.seed(seed)
np.random.seed(seed)
torch.manual_seed(seed)
torch.cuda.manual_seed(seed)
torch.backends.cudnn.deterministic = True
torch.backends.cudnn.be... | 2.359375 | 2 |
recipes/freeimage/all/conanfile.py | marsven/conan-center-index | 0 | 7688 | from conans import ConanFile, CMake, tools
import os
import shutil
required_conan_version = ">=1.43.0"
class FreeImageConan(ConanFile):
name = "freeimage"
description = "Open Source library project for developers who would like to support popular graphics image formats"\
"like PNG, BMP, JPE... | 1.867188 | 2 |
src/google/appengine/datastore/datastore_query.py | myelin/appengine-python-standard | 0 | 7689 | <reponame>myelin/appengine-python-standard<gh_stars>0
#!/usr/bin/env python
#
# Copyright 2007 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/license... | 1.609375 | 2 |
tests/Metrics/test_recall.py | Neklaustares-tPtwP/torchflare | 1 | 7690 | <reponame>Neklaustares-tPtwP/torchflare
# flake8: noqa
import warnings
import pytest
import torch
from sklearn.exceptions import UndefinedMetricWarning
from sklearn.metrics import recall_score
from torchflare.metrics.recall_meter import Recall
from torchflare.metrics.meters import _BaseInputHandler
torch.manual_seed... | 2.046875 | 2 |
parsing/tests/test_utils.py | davesque/parsing.py | 1 | 7691 | <filename>parsing/tests/test_utils.py
from __future__ import unicode_literals
import unittest
from ..utils import compose, flatten, truncate, join, unary, equals
class TestEquals(unittest.TestCase):
def test_it_should_return_a_function_that_compares_against_x(self):
self.assertTrue(equals(234)(234))
... | 2.75 | 3 |
Array/Final450/Move_Negative_Nums_To_One_End/relative_order_matters/move_negative_nums_to_one_end--insertion_sort_modified.py | prash-kr-meena/GoogleR | 0 | 7692 | <reponame>prash-kr-meena/GoogleR
from Utils.Array import input_array
# Time : O(n2)
# Space : O(1) Constant space
"""
Ill be having 2 pointers here
one of them will move through the array looking for -ve numbers to operate on
and another will be pointing to the correct location where i can put the -ve elements, aft... | 4.125 | 4 |
python_test/test_epoll/test_epoll.py | zhtsh/test-examples | 0 | 7693 | <reponame>zhtsh/test-examples
# coding=utf8
import socket
import select
from datetime import datetime
from datetime import timedelta
EOL = b'\n\n'
response = b'HTTP/1.0 200 OK\nDate: Mon, 1 Jan 1996 01:01:01 GMT\n'
response += b'Content-Type: text/plain\nContent-Length: 13\n\n'
response += b'Hello, world!\n... | 2.890625 | 3 |
20.2-Donut/Donut2.py | Kehvarl/AdventOfCode2019 | 1 | 7694 | <gh_stars>1-10
import collections
from pprint import pprint
example1 = open("input.txt", "r").read()
# grid = [[val for val in line] for line in example1.split("\n")]
grid = example1.split("\n")
length = 0
for line in grid:
length = max(len(line), length)
out = []
for line in grid:
out.append(line[::-1].zfi... | 3.09375 | 3 |
OR_Client_Library/openrefine_client/tests/test_history.py | idaks/OpenRefine-Provenance-Tools | 0 | 7695 | #!/usr/bin/env python
"""
test_history.py
"""
# Copyright (c) 2011 <NAME>, Real Programmers. All rights reserved.
import unittest
from OR_Client_Library.openrefine_client.google.refine.history import *
class HistoryTest(unittest.TestCase):
def test_init(self):
response = {
u"code": "ok",
... | 2.6875 | 3 |
tests/batch/test_get_batch.py | Remmeauth/remme-core-cli | 0 | 7696 | """
Provide tests for command line interface's get batch command.
"""
import json
import pytest
from click.testing import CliRunner
from cli.constants import (
DEV_BRANCH_NODE_IP_ADDRESS_FOR_TESTING,
FAILED_EXIT_FROM_COMMAND_CODE,
PASSED_EXIT_FROM_COMMAND_CODE,
)
from cli.entrypoint import cli
from cli.ut... | 2.515625 | 3 |
experiments/scripts/preprocess_dataset.py | pbielak/graph-barlow-twins | 9 | 7697 | import sys
from gssl.datasets import load_dataset
from gssl.inductive.datasets import load_ppi
from gssl.utils import seed
def main():
seed()
# Read dataset name
dataset_name = sys.argv[1]
# Load dataset
if dataset_name == "PPI":
load_ppi()
else:
load_dataset(name=dataset_na... | 1.851563 | 2 |
agro_site/orders/migrations/0001_initial.py | LukoninDmitryPy/agro_site-2 | 0 | 7698 | <reponame>LukoninDmitryPy/agro_site-2<filename>agro_site/orders/migrations/0001_initial.py
# Generated by Django 2.2.16 on 2022-04-12 13:28
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.db.models.expressions
import django.utils.timezone
class... | 1.492188 | 1 |
app/forms.py | FakeYou/flask-microblog | 0 | 7699 | from flask.ext.wtf import Form
from wtforms import StringField, BooleanField, PasswordField
from wtforms.validators import InputRequired, Email, EqualTo, Length
class LoginForm(Form):
nickname = StringField('nickname', validators=[InputRequired()])
password = PasswordField('password', validators=[InputRequired... | 2.828125 | 3 |