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 |
|---|---|---|---|---|---|---|
tests/test_hrepr.py | fabaff/hrepr | 0 | 3200 | from dataclasses import dataclass
from hrepr import H
from hrepr import hrepr as real_hrepr
from hrepr.h import styledir
from .common import one_test_per_assert
css_hrepr = open(f"{styledir}/hrepr.css", encoding="utf-8").read()
hrepr = real_hrepr.variant(fill_resources=False)
@dataclass
class Point:
x: int
... | 2.46875 | 2 |
sympy/assumptions/assume.py | shivangdubey/sympy | 2 | 3201 | <filename>sympy/assumptions/assume.py
import inspect
from sympy.core.cache import cacheit
from sympy.core.singleton import S
from sympy.core.sympify import _sympify
from sympy.logic.boolalg import Boolean
from sympy.utilities.source import get_class
from contextlib import contextmanager
class AssumptionsContext(set):... | 2.65625 | 3 |
distancematrix/tests/consumer/test_distance_matrix.py | IDLabResearch/seriesdistancematrix | 12 | 3202 | import numpy as np
from unittest import TestCase
import numpy.testing as npt
from distancematrix.util import diag_indices_of
from distancematrix.consumer.distance_matrix import DistanceMatrix
class TestContextualMatrixProfile(TestCase):
def setUp(self):
self.dist_matrix = np.array([
[8.67, 1... | 2.421875 | 2 |
supervisor/const.py | peddamat/home-assistant-supervisor-test | 0 | 3203 | """Constants file for Supervisor."""
from enum import Enum
from ipaddress import ip_network
from pathlib import Path
SUPERVISOR_VERSION = "DEV"
URL_HASSIO_ADDONS = "https://github.com/home-assistant/addons"
URL_HASSIO_APPARMOR = "https://version.home-assistant.io/apparmor.txt"
URL_HASSIO_VERSION = "https://version.ho... | 2.125 | 2 |
quaesit/agent.py | jgregoriods/quaesit | 0 | 3204 | <gh_stars>0
import inspect
from math import hypot, sin, asin, cos, radians, degrees
from abc import ABCMeta, abstractmethod
from random import randint, choice
from typing import Dict, List, Tuple, Union
class Agent(metaclass=ABCMeta):
"""
Class to represent an agent in an agent-based model.
"""
_id ... | 3.171875 | 3 |
models/LRF_COCO_300.py | vaesl/LRF-Net | 180 | 3205 | import torch
import torch.nn as nn
import os
import torch.nn.functional as F
class LDS(nn.Module):
def __init__(self,):
super(LDS, self).__init__()
self.pool1 = nn.MaxPool2d(kernel_size=(2, 2), stride=2, padding=0)
self.pool2 = nn.MaxPool2d(kernel_size=(2, 2), stride=2, padding=0)
... | 2.59375 | 3 |
tests/test.py | chromia/wandplus | 0 | 3206 | <reponame>chromia/wandplus<gh_stars>0
#!/usr/bin/env python
from wand.image import Image
from wand.drawing import Drawing
from wand.color import Color
import wandplus.image as wpi
from wandplus.textutil import calcSuitableFontsize, calcSuitableImagesize
import os
import unittest
tmpdir = '_tmp/'
def save(img, func... | 2.421875 | 2 |
src/librender/tests/test_mesh.py | tizian/layer-laboratory | 7 | 3207 | <gh_stars>1-10
import mitsuba
import pytest
import enoki as ek
from enoki.dynamic import Float32 as Float
from mitsuba.python.test.util import fresolver_append_path
from mitsuba.python.util import traverse
def test01_create_mesh(variant_scalar_rgb):
from mitsuba.core import Struct, float_dtype
from mitsuba.r... | 1.859375 | 2 |
agsadmin/sharing_admin/community/groups/Group.py | christopherblanchfield/agsadmin | 2 | 3208 | from __future__ import (absolute_import, division, print_function, unicode_literals)
from builtins import (ascii, bytes, chr, dict, filter, hex, input, int, map, next, oct, open, pow, range, round, str,
super, zip)
from ...._utils import send_session_request
from ..._PortalEndpointBase import Por... | 2.109375 | 2 |
amy/workshops/migrations/0191_auto_20190809_0936.py | code-review-doctor/amy | 53 | 3209 | <gh_stars>10-100
# Generated by Django 2.1.7 on 2019-08-09 09:36
from django.db import migrations, models
def migrate_public_event(apps, schema_editor):
"""Migrate options previously with no contents (displayed as "Other:")
to a new contents ("other").
The field containing these options is in CommonReque... | 1.765625 | 2 |
pix2pix/Discriminator.py | yubin1219/GAN | 0 | 3210 | <gh_stars>0
import torch
import torch.nn as nn
class Discriminator(nn.Module):
def __init__(self, input_nc, ndf=64, norm_layer=nn.BatchNorm2d, use_sigmoid=False) :
super(Discriminator, self).__init__()
self.conv1 = nn.Sequential(
nn.Conv2d(input_nc, ndf, kernel_size=4, stride=2, padding=1),
nn.Le... | 2.328125 | 2 |
tests/slicebuilders/subpopulations/test_length.py | ANarayan/robustness-gym | 0 | 3211 | from unittest import TestCase
import numpy as np
from robustnessgym.cachedops.spacy import Spacy
from robustnessgym.slicebuilders.subpopulations.length import LengthSubpopulation
from tests.testbeds import MockTestBedv0
class TestLengthSubpopulation(TestCase):
def setUp(self):
self.testbed = MockTestBed... | 2.671875 | 3 |
pulsar_spectra/catalogue_papers/Jankowski_2018_raw_to_yaml.py | NickSwainston/pulsar_spectra | 0 | 3212 | import json
from astroquery.vizier import Vizier
with open("Jankowski_2018_raw.txt", "r") as raw_file:
lines = raw_file.readlines()
print(lines)
pulsar_dict = {}
for row in lines[3:]:
row = row.split("|")
print(row)
pulsar = row[0].strip().replace("−", "-")
freqs = []
fluxs = []
flux_e... | 2.765625 | 3 |
integration-tests/run-intg-test.py | NishikaDeSilva/identity-test-integration | 4 | 3213 | # Copyright (c) 2018, WSO2 Inc. (http://wso2.com) 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 ap... | 1.34375 | 1 |
src/pytest_notification/sound.py | rhpvorderman/pytest-notification | 2 | 3214 | # Copyright (c) 2019 Leiden University Medical Center
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, me... | 1.9375 | 2 |
7KYU/next_prime.py | yaznasivasai/python_codewars | 4 | 3215 | <reponame>yaznasivasai/python_codewars
from math import sqrt
def is_simple(n: int) -> bool:
if n % 2 == 0 and n != 2:
return False
for i in range (3, int(sqrt(n)) + 2, 2):
if n % i == 0 and n != i:
return False
return True
def next_prime(n: int) -> int:
n += 1
if n <= ... | 4.0625 | 4 |
cozmo_sdk_examples/if_this_then_that/ifttt_gmail.py | manxueitp/cozmo-test | 0 | 3216 | #!/usr/bin/env python3
# Copyright (c) 2016 Anki, 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 in the file LICENSE.txt or at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... | 3.15625 | 3 |
plotutils.py | parkus/mypy | 1 | 3217 | # -*- coding: utf-8 -*-
"""
Created on Fri May 30 17:15:27 2014
@author: Parke
"""
from __future__ import division, print_function, absolute_import
import numpy as np
import matplotlib as mplot
import matplotlib.pyplot as plt
import mypy.my_numpy as mnp
dpi = 100
fullwidth = 10.0
halfwidth = 5.0
# use these with li... | 2.59375 | 3 |
marvel_world/views.py | xiaoranppp/si664-final | 0 | 3218 | from django.shortcuts import render,redirect
from django.http import HttpResponse,HttpResponseRedirect
from django.views import generic
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator
from .models import Character,Comic,Power,CharacterPower,CharacterComic
f... | 2.15625 | 2 |
src/rpi/fwd.py | au-chrismor/selfdrive | 0 | 3219 | """Set-up and execute the main loop"""
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
#Right motor input A
GPIO.setup(18,GPIO.OUT)
#Right motor input B
GPIO.setup(23,GPIO.OUT)
GPIO.output(18,GPIO.HIGH)
GPIO.output(23,GPIO.LOW)
| 3.078125 | 3 |
util/get_from_db.py | Abel-Huang/simple-image-classifier | 4 | 3220 | import pymysql
# 连接配置信息
config = {
'host': '127.0.0.1',
'port': 3306,
'user': 'root',
'password': '',
'db': 'classdata',
'charset': 'utf8',
'cursorclass': pymysql.cursors.DictCursor,
}
def get_summary_db(unitag):
# 创建连接
conn = pymysql.connect(**config)
cur = conn.cursor()
... | 2.78125 | 3 |
registerapp/api.py | RajapandiR/django-register | 0 | 3221 | <gh_stars>0
from rest_framework import viewsets
from rest_framework.views import APIView
from registerapp import serializers
from registerapp import models
class RegisterViewSet(viewsets.ModelViewSet):
serializer_class = serializers.RegisterSerializer
queryset = models.RegisterPage.objects.all()
| 1.554688 | 2 |
jduck/robot.py | luutp/jduck | 0 | 3222 | <reponame>luutp/jduck
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
jduck.py
Description:
Author: luutp
Contact: <EMAIL>
Created on: 2021/02/27
"""
# Utilities
# %%
# ================================IMPORT PACKAGES====================================
# Utilities
from traitlets.config.configurable import Singleto... | 2.359375 | 2 |
src/nebulo/gql/alias.py | olirice/nebulo | 76 | 3223 | # pylint: disable=missing-class-docstring,invalid-name
import typing
from graphql.language import (
InputObjectTypeDefinitionNode,
InputObjectTypeExtensionNode,
ObjectTypeDefinitionNode,
ObjectTypeExtensionNode,
)
from graphql.type import (
GraphQLArgument,
GraphQLBoolean,
GraphQLEnumType,
... | 1.617188 | 2 |
integrations/tensorflow/bindings/python/pyiree/tf/compiler/saved_model_test.py | rise-lang/iree | 1 | 3224 | # Copyright 2019 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | 1.914063 | 2 |
api/models/indicator/child_objects/properties.py | taco-chainalysis/pypulsedive | 0 | 3225 | <reponame>taco-chainalysis/pypulsedive
from .grandchild_objects import Cookies
from .grandchild_objects import Dns
from .grandchild_objects import Dom
from .grandchild_objects import Geo
#from .grandchild_objects import Http
#from .grandchild_objects import Meta
from .grandchild_objects import Ssl
#from .grandchild_obj... | 2.15625 | 2 |
iRep/gc_skew.py | scottdaniel/iRep | 55 | 3226 | #!/usr/bin/env python3
"""
script for calculating gc skew
<NAME>
<EMAIL>
"""
# python modules
import os
import sys
import argparse
import numpy as np
from scipy import signal
from itertools import cycle, product
# plotting modules
from matplotlib import use as mplUse
mplUse('Agg')
import matplotlib.pyplot as plt
fr... | 2.484375 | 2 |
examples/send_governance_vote_transaction.py | Algofiorg/algofi-py-sdk | 38 | 3227 | <reponame>Algofiorg/algofi-py-sdk
# This sample is provided for demonstration purposes only.
# It is not intended for production use.
# This example does not constitute trading advice.
import os
from dotenv import dotenv_values
from algosdk import mnemonic, account
from algofi.v1.asset import Asset
from algofi.v1.clien... | 1.898438 | 2 |
bid/inventoryClient.py | franklx/SOAPpy-py3 | 7 | 3228 | <gh_stars>1-10
#!/usr/bin/env python
import getopt
import sys
import string
import re
import time
sys.path.insert(1,"..")
from SOAPpy import SOAP
import traceback
DEFAULT_SERVERS_FILE = './inventory.servers'
DEFAULT_METHODS = ('SimpleBuy', 'RequestForQuote','Buy','Ping')
def usage (error = None):
sys.s... | 2.703125 | 3 |
src/compile.py | Pixxeasy/WinTools | 0 | 3229 | import os
import json
import shutil
with open("entry.tp") as entry:
entry = json.loads(entry.read())
startcmd = entry['plugin_start_cmd'].split("%TP_PLUGIN_FOLDER%")[1].split("\\")
filedirectory = startcmd[0]
fileName = startcmd[1]
if os.path.exists(filedirectory):
os.remove(os.path.join(os.getcwd(), "Wi... | 2.375 | 2 |
suda/1121/12.py | tusikalanse/acm-icpc | 2 | 3230 | <reponame>tusikalanse/acm-icpc
for _ in range(int(input())):
x, y = list(map(int, input().split()))
flag = 1
for i in range(x, y + 1):
n = i * i + i + 41
for j in range(2, n):
if j * j > n:
break
if n % j == 0:
flag = 0
break
if flag == 0:
break
if flag:
print("OK")
else:
print("Sorr... | 2.9375 | 3 |
notification/app/node_modules/hiredis/binding.gyp | c2gconsulting/bulkpay | 208 | 3231 | {
'targets': [
{
'target_name': 'hiredis',
'sources': [
'src/hiredis.cc'
, 'src/reader.cc'
],
'include_dirs': ["<!(node -e \"require('nan')\")"],
'dependencies': [
'deps/hiredis.gyp:hiredis-c'
],
'defines': [
'_GNU_SOURCE'
],
... | 1.007813 | 1 |
basic_and.py | Verkhovskaya/PyDL | 5 | 3232 | <reponame>Verkhovskaya/PyDL
from pywire import *
def invert(signal):
if signal:
return False
else:
return True
class Inverter:
def __init__(self, a, b):
b.drive(invert, a)
width = 4
a = Signal(width, io="in")
b = Signal(width, io="out")
Inverter(a, b)
build() | 2.6875 | 3 |
network/evaluate_keypoints.py | mhsung/deep-functional-dictionaries | 41 | 3233 | # <NAME> (<EMAIL>)
# April 2018
import os, sys
BASE_DIR = os.path.normpath(
os.path.join(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(os.path.join(BASE_DIR, '..'))
from datasets import *
from generate_outputs import *
from scipy.optimize import linear_sum_assignment
#import matplotlib.pyplot a... | 2.25 | 2 |
recipes/cxxopts/all/conanfile.py | dvirtz/conan-center-index | 562 | 3234 | import os
from conans import ConanFile, tools
from conans.errors import ConanInvalidConfiguration
class CxxOptsConan(ConanFile):
name = "cxxopts"
homepage = "https://github.com/jarro2783/cxxopts"
url = "https://github.com/conan-io/conan-center-index"
description = "Lightweight C++ option parser librar... | 2.15625 | 2 |
p_030_039/problem31.py | ericgreveson/projecteuler | 0 | 3235 | <gh_stars>0
class CoinArray(list):
"""
Coin list that is hashable for storage in sets
The 8 entries are [1p count, 2p count, 5p count, ... , 200p count]
"""
def __hash__(self):
"""
Hash this as a string
"""
return hash(" ".join([str(i) for i in self]))
def main():
... | 3.40625 | 3 |
video/cloud-client/quickstart/quickstart.py | nasirdec/GCP-AppEngine-Example | 1 | 3236 | <reponame>nasirdec/GCP-AppEngine-Example
#!/usr/bin/env python
# Copyright 2017 Google Inc. 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... | 2.453125 | 2 |
ally/instrument.py | platformmaster9/PyAlly | 0 | 3237 | from . import utils
#################################################
""" INSTRUMENT """
#################################################
def Instrument(symbol):
symbol = str(symbol).upper()
return {
'__symbol' : symbol,
'Sym' : symbol,
'SecTyp' : 'CS',
... | 2.5 | 2 |
airbyte-integrations/connectors/source-yahoo-finance-price/integration_tests/acceptance.py | onaio/airbyte | 22 | 3238 | <gh_stars>10-100
#
# Copyright (c) 2022 Airbyte, Inc., all rights reserved.
#
import pytest
pytest_plugins = ("source_acceptance_test.plugin",)
@pytest.fixture(scope="session", autouse=True)
def connector_setup():
"""This fixture is a placeholder for external resources that acceptance test might require."""
... | 1.625 | 2 |
ddt/__init__.py | GawenChen/test_pytest | 0 | 3239 | <filename>ddt/__init__.py<gh_stars>0
# -*- coding: utf-8 -*-
"""
@Time : 2021/10/9 17:51
@Auth : 潇湘
@File :__init__.py.py
@IDE :PyCharm
@QQ : 810400085
""" | 1.101563 | 1 |
darts/models/linear_regression_model.py | BiancaMT25/darts | 1 | 3240 | """
Standard Regression model
-------------------------
"""
import numpy as np
import pandas as pd
from typing import Union
from ..logging import get_logger
from .regression_model import RegressionModel
from sklearn.linear_model import LinearRegression
logger = get_logger(__name__)
class LinearRegressionModel(Regre... | 3.25 | 3 |
hail/python/test/hailtop/utils/test_utils.py | vrautela/hail | 0 | 3241 | <reponame>vrautela/hail<gh_stars>0
from hailtop.utils import (partition, url_basename, url_join, url_scheme,
url_and_params, parse_docker_image_reference)
def test_partition_zero_empty():
assert list(partition(0, [])) == []
def test_partition_even_small():
assert list(partition(3,... | 2.453125 | 2 |
hood/urls.py | wadi-1000/Vicinity | 0 | 3242 | <reponame>wadi-1000/Vicinity
from django.urls import path,include
from . import views
urlpatterns = [
path('home/', views.home, name = 'home'),
path('add_hood/',views.uploadNeighbourhood, name = 'add_hood'),
path('viewhood/',views.viewHood, name = 'viewhood'),
path('hood/<int:pk>/',views.hood, name = '... | 1.867188 | 2 |
src/licensedcode/tokenize.py | chetanya-shrimali/scancode-toolkit | 0 | 3243 | <reponame>chetanya-shrimali/scancode-toolkit<filename>src/licensedcode/tokenize.py
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 nexB Inc. and others. All rights reserved.
# http://nexb.com and https://github.com/nexB/scancode-toolkit/
# The ScanCode software is licensed under the Apache License version 2.0.
# Data ge... | 1.570313 | 2 |
etest_test/fixtures_test/ebuilds_test/__init__.py | alunduil/etest | 6 | 3244 | <filename>etest_test/fixtures_test/ebuilds_test/__init__.py
"""Ebuild Test Fixtures."""
import os
from typing import Any, Dict, List
from etest_test import helpers_test
EBUILDS: Dict[str, List[Dict[str, Any]]] = {}
helpers_test.import_directory(__name__, os.path.dirname(__file__))
| 1.765625 | 2 |
src/model.py | palucki/RememberIt | 0 | 3245 | import random
from pymongo import MongoClient
from observable import Observable
from phrase import Phrase
class MongoDbProxy:
"""Proxy for MongoDB"""
def __init__(self, url, dbName, tableName):
self.client = MongoClient(url)
self.db = self.client[dbName]
self.table = tableName
... | 2.78125 | 3 |
sampleApplication/clientGenerator.py | chall68/BlackWatch | 0 | 3246 | #!flask/bin/python
#from user import User
from sampleObjects.User import User
from datetime import datetime
from sampleObjects.DetectionPoint import DetectionPoint
import time, requests, random, atexit
def requestGenerator():
userObject = randomUser()
detectionPointObject = randomDetectionPoint()
req = r... | 2.703125 | 3 |
news_collector/collector/consumers.py | ridwaniyas/channels-examples | 0 | 3247 | <gh_stars>0
import asyncio
import json
import datetime
from aiohttp import ClientSession
from channels.generic.http import AsyncHttpConsumer
from .constants import BLOGS
class NewsCollectorAsyncConsumer(AsyncHttpConsumer):
"""
Async HTTP consumer that fetches URLs.
"""
async def handle(self, body):
... | 3.234375 | 3 |
src/randomcsv/FileUtils.py | PhilipBuhr/randomCsv | 0 | 3248 | import os
from pathlib import Path
def write(file_name, content):
Path(os.path.dirname(file_name)).mkdir(parents=True, exist_ok=True)
with open(file_name, 'w') as file:
file.write(content)
def read_line_looping(file_name, count):
i = 0
lines = []
file = open(file_name, 'r')
line = fi... | 3.546875 | 4 |
stringtoiso/__init__.py | vats98754/stringtoiso | 0 | 3249 | from stringtoiso.convert_to_iso import convert | 1.15625 | 1 |
aux_sys_err_prediction_module/additive/R_runmed_spline/my_R_runmed_spline_analysis.py | PNNL-Comp-Mass-Spec/DtaRefinery | 0 | 3250 | from aux_sys_err_prediction_module.additive.R_runmed_spline.my_R_runmed_spline_fit import R_runmed_smooth_spline
from numpy import random, array, median, zeros, arange, hstack
from win32com.client import Dispatch
import math
myName = 'R_runmed_spline'
useMAD = True # use median absolute deviations instead of ... | 2.359375 | 2 |
setup.py | Ms2ger/python-zstandard | 0 | 3251 | #!/usr/bin/env python
# Copyright (c) 2016-present, <NAME>
# All rights reserved.
#
# This software may be modified and distributed under the terms
# of the BSD license. See the LICENSE file for details.
import os
import sys
from setuptools import setup
try:
import cffi
except ImportError:
cffi = None
import... | 1.695313 | 2 |
Escolas/Curso em Video/Back-End/Curso de Python/Mundos/Mundo 01/Exercicio_16.py | c4st1lh0/Projetos-de-Aula | 0 | 3252 | <gh_stars>0
import math
num = float(input('Digite um numero real qualquer: '))
print('O numero: {} tem a parte inteira {}'.format(num, math.trunc(num))) | 3.625 | 4 |
mmdet/ops/orn/functions/__init__.py | JarvisUSTC/DARDet | 274 | 3253 | <filename>mmdet/ops/orn/functions/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import torch
from .active_rotating_filter import active_rotating_filter
from .active_rotating_filter import ActiveRotatingFilter
from .rotation_invariant_encoding import rotation_invariant_encoding
from... | 1.289063 | 1 |
sympy/core/tests/test_cache.py | eriknw/sympy | 7 | 3254 | <reponame>eriknw/sympy
from sympy.core.cache import cacheit
def test_cacheit_doc():
@cacheit
def testfn():
"test docstring"
pass
assert testfn.__doc__ == "test docstring"
assert testfn.__name__ == "testfn"
| 2.25 | 2 |
mmdet/models/losses/ranking_losses.py | VietDunghacker/VarifocalNet | 0 | 3255 | <gh_stars>0
import torch
class RankSort(torch.autograd.Function):
@staticmethod
def forward(ctx, logits, targets, delta_RS=0.50, eps=1e-10):
classification_grads=torch.zeros(logits.shape).cuda()
#Filter fg logits
fg_labels = (targets > 0.)
fg_logits = logits[fg_labels]
fg_targets = targets[fg_labels]
... | 2.234375 | 2 |
tests/test_dcd_api.py | sadamek/pyIMX | 0 | 3256 | # Copyright (c) 2017-2018 <NAME>
#
# SPDX-License-Identifier: BSD-3-Clause
# The BSD-3-Clause license for this file can be found in the LICENSE file included with this distribution
# or at https://spdx.org/licenses/BSD-3-Clause.html#licenseText
import os
import pytest
from imx import img
# Used Directories
DATA_DIR =... | 2.0625 | 2 |
recentjson.py | nydailynews/feedutils | 0 | 3257 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Return recent items from a json feed. Recent means "In the last X days."
import os
import doctest
import json
import urllib2
import argparse
import types
import gzip
from datetime import datetime, timedelta
from time import mktime
class RecentJson:
""" Methods for in... | 3.484375 | 3 |
maint/MultiStage2.py | Liastre/pcre2 | 0 | 3258 | <gh_stars>0
#! /usr/bin/python
# Multistage table builder
# (c) <NAME>, 2008
##############################################################################
# This script was submitted to the PCRE project by <NAME>owski as part of
# the upgrading of Unicode property support. The new code speeds up property
# matching ... | 1.765625 | 2 |
setup.py | ihayhurst/RetroBioCat | 9 | 3259 | from setuptools import setup, find_packages
from retrobiocat_web import __version__
with open('requirements.txt') as f:
requirements = f.read().splitlines()
setup(
name = 'retrobiocat_web',
packages = find_packages(),
include_package_data=True,
version = __version__,
license='',
description = 'Retrosynt... | 1.375 | 1 |
rxn_yield_context/preprocess_data/preprocess/augmentation_utils.py | Lung-Yi/rxn_yield_context | 0 | 3260 | # -*- coding: utf-8 -*-
import pickle
import numpy as np
from rdkit import Chem
from rdkit.Chem import AllChem,DataStructs
def get_classes(path):
f = open(path, 'rb')
dict_ = pickle.load(f)
f.close()
classes = sorted(dict_.items(), key=lambda d: d[1],reverse=True)
classes = [(x,y) fo... | 2.4375 | 2 |
src/webstruct-demo/__init__.py | zanachka/webstruct-demo | 5 | 3261 | import functools
import logging
import random
from flask import Flask, render_template, request
import joblib
from lxml.html import html5parser
import lxml.html
import requests
import yarl
import webstruct.model
import webstruct.sequence_encoding
import webstruct.webannotator
webstruct_demo = Flask(__name__, instan... | 2.1875 | 2 |
setup.py | Liang813/einops | 4,738 | 3262 | <gh_stars>1000+
__author__ = '<NAME>'
from setuptools import setup
setup(
name="einops",
version='0.3.2',
description="A new flavour of deep learning operations",
long_description=open('README.md', encoding='utf-8').read(),
long_description_content_type='text/markdown',
url='https://github.com... | 1.445313 | 1 |
website/migrations/0084_auto_20210215_1401.py | czhu1217/cmimc-online | 0 | 3263 | # Generated by Django 3.1.6 on 2021-02-15 19:01
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('website', '0083_remove_aisubmission_code'),
]
operations = [
migrations.AddField(
model_name='e... | 1.664063 | 2 |
ldp/tasks/dlp.py | evandez/low-dimensional-probing | 1 | 3264 | """Core experiments for the dependency label prediction task."""
import collections
import copy
import logging
from typing import (Any, Dict, Iterator, Optional, Sequence, Set, Tuple, Type,
Union)
from ldp import datasets, learning
from ldp.models import probes, projections
from ldp.parse import pt... | 2.484375 | 2 |
pycquery_krb/common/ccache.py | naver/PyCQuery | 2 | 3265 | <filename>pycquery_krb/common/ccache.py
#!/usr/bin/env python3
#
# Author:
# <NAME> (@skelsec)
#
import os
import io
import datetime
import glob
import hashlib
from pycquery_krb.protocol.asn1_structs import Ticket, EncryptedData, \
krb5_pvno, KrbCredInfo, EncryptionKey, KRBCRED, TicketFlags, EncKrbCredPart
from pyc... | 2.40625 | 2 |
getUniformSmiles.py | OpenEye-Contrib/Molecular-List-Logic | 2 | 3266 | #!/opt/az/psf/python/2.7/bin/python
from openeye.oechem import *
import cgi
#creates a list of smiles of the syntax [smiles|molId,smiles|molId]
def process_smiles(smiles):
smiles = smiles.split('\n')
mol = OEGraphMol()
smiles_list=[]
for line in smiles:
if len(line.rstrip())>0:
lin... | 2.65625 | 3 |
mfem/_par/gridfunc.py | mfem/PyMFEM | 93 | 3267 | <filename>mfem/_par/gridfunc.py
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 4.0.2
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info as _swig_python_version_info
if _swig_python_version_inf... | 2.15625 | 2 |
src/tracks/settings.py | adcarmichael/tracks | 0 | 3268 | import os
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
PWA_SERVICE_WORKER_PATH = os.path.join(
BASE_DIR, 'routes/static/routes/js', 'serv... | 2.0625 | 2 |
examples/04-lights/plotter_builtins.py | akeshavan/pyvista | 0 | 3269 | <reponame>akeshavan/pyvista
"""
Plotter Lighting Systems
~~~~~~~~~~~~~~~~~~~~~~~~
The :class:`pyvista.Plotter` class comes with three options for the default
lighting system:
* a light kit consisting of a headlight and four camera lights,
* an illumination system containing three lights arranged around the camera... | 2.828125 | 3 |
src/swimport/tests/15_char_arrays/main.py | talos-gis/swimport | 1 | 3270 | <reponame>talos-gis/swimport<gh_stars>1-10
from swimport.all import *
src = FileSource('src.h')
swim = Swim('example')
swim(pools.c_string)
swim(pools.numpy_arrays(r"../resources", allow_char_arrays=True))
swim(pools.include(src))
assert swim(Function.Behaviour()(src)) > 0
swim.write('example.i')
print('ok!') | 1.984375 | 2 |
ipyvolume/astro.py | larsoner/ipyvolume | 1 | 3271 | <gh_stars>1-10
import numpy as np
import PIL.Image
import pythreejs
import ipyvolume as ipv
from .datasets import UrlCached
def _randomSO3():
"""return random rotatation matrix, algo by <NAME>"""
u1 = np.random.random()
u2 = np.random.random()
u3 = np.random.random()
R = np.array([[np.cos(2*np.pi... | 3 | 3 |
deepfunning/function.py | Zrealshadow/DeepFunning | 0 | 3272 | '''
* @author Waldinsamkeit
* @email <EMAIL>
* @create date 2020-09-25 14:33:38
* @desc
'''
import torch
'''--------------------- Weighted Binary cross Entropy ----------------------'''
'''
In Torch BCELoss, weight is set to every element of input instead of to every class
'''
def weighted_binary_cross_entropy... | 2.71875 | 3 |
dlms_cosem/hdlc/address.py | pwitab/dlms-cosem | 35 | 3273 | from typing import *
import attr
from dlms_cosem.hdlc import validators
@attr.s(auto_attribs=True)
class HdlcAddress:
"""
A client address shall always be expressed on one byte.
To enable addressing more than one logical device within a single physical device
and to support the multi-drop configurat... | 3.15625 | 3 |
benchmarks/benchmarks/stats.py | RasmusSemmle/scipy | 1 | 3274 | from __future__ import division, absolute_import, print_function
import warnings
import numpy as np
try:
import scipy.stats as stats
except ImportError:
pass
from .common import Benchmark
class Anderson_KSamp(Benchmark):
def setup(self, *args):
self.rand = [np.random.normal(loc=i, size=1000) fo... | 2.21875 | 2 |
src/production_ecommerce/account/models.py | sheriffbarrow/production-ecommerce | 1 | 3275 | <gh_stars>1-10
from django.db import models
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager
class MyAccountManager(BaseUserManager):
def create_user(self, email, username, password=None):
if not email:
raise ValueError('Users must have an email address')
if not username:
raise Valu... | 2.546875 | 3 |
dbtmetabase/models/config.py | fernandobrito/dbt-metabase | 0 | 3276 | from dataclasses import dataclass, field
from typing import Optional, Iterable, Union
@dataclass
class MetabaseConfig:
# Metabase Client
database: str
host: str
user: str
password: str
# Metabase additional connection opts
use_http: bool = False
verify: Union[str, bool] = True
# Me... | 2.21875 | 2 |
src/plot_timeseries_outstanding_bytes.py | arunksaha/heap_tracker | 1 | 3277 | <reponame>arunksaha/heap_tracker<filename>src/plot_timeseries_outstanding_bytes.py<gh_stars>1-10
#
# Copyright 2018, <NAME> <<EMAIL>>
#
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.dates as md
import datetime as dt
import sys
import os
# Open the file, read the string contents into a list,
# and... | 2.671875 | 3 |
import.py | vmariano/meme-classifier | 0 | 3278 | from dotenv import load_dotenv
load_dotenv()
import sys
import os
import re
import json
import psycopg2
from meme_classifier.images import process_image
path = sys.argv[1]
data = json.load(open(os.path.join(path, 'result.json'), 'r'))
chat_id = data['id']
conn = psycopg2.connect(os.getenv('POSTGRES_CREDENTIALS'))
... | 2.390625 | 2 |
nps/migrations/0013_auto_20180314_1805.py | jak0203/nps-dash | 0 | 3279 | # Generated by Django 2.0.3 on 2018-03-15 01:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('nps', '0012_auto_20180314_1600'),
]
operations = [
migrations.CreateModel(
name='ClientAggregations',
fields=[
... | 1.679688 | 2 |
docs/schema_mapping.py | NoAnyLove/pydantic | 1 | 3280 | <reponame>NoAnyLove/pydantic
#!/usr/bin/env python3
"""
Build a table of Python / Pydantic to JSON Schema mappings.
Done like this rather than as a raw rst table to make future edits easier.
Please edit this file directly not .tmp_schema_mappings.rst
"""
table = [
[
'bool',
'boolean',
'',... | 2.34375 | 2 |
hubspot3/test/test_broadcast.py | kevin2357/hubspot3 | 1 | 3281 | import time
import unittest
from nose.plugins.attrib import attr
from hubspot3.test import helper
from hubspot3.broadcast import Broadcast, BroadcastClient
class BroadcastClientTest(unittest.TestCase):
""" Unit tests for the HubSpot Broadcast API Python client.
This file contains some unittest tests for the ... | 2.6875 | 3 |
benchmark/benchmarks/testdata.py | theroggy/geofile_ops | 0 | 3282 | <filename>benchmark/benchmarks/testdata.py
# -*- coding: utf-8 -*-
"""
Module to prepare test data for benchmarking geo operations.
"""
import enum
import logging
from pathlib import Path
import pprint
import shutil
import sys
import tempfile
from typing import Optional
import urllib.request
import zipfile
# Add path... | 2.34375 | 2 |
relocation/depth/setup_relocation_dir.py | ziyixi/SeisScripts | 0 | 3283 | <reponame>ziyixi/SeisScripts
"""
setup earthquake depth relocation directory
"""
import obspy
import sh
import numpy as np
import click
from os.path import join
from glob import glob
import copy
def generate_new_cmtsolution_files(cmts_dir, generated_cmts_dir, depth_perturbation_list):
cmt_names = glob(join(cmts_... | 2.046875 | 2 |
python-client/trustedanalytics/core/atktypes.py | blbarker/atk | 1 | 3284 | <reponame>blbarker/atk
# vim: set encoding=utf-8
#
# Copyright (c) 2015 Intel Corporation
#
# 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/LICENS... | 1.953125 | 2 |
srd/pageaggregator.py | poikilos/tabletopManualMiner | 0 | 3285 | #!/usr/bin/env python3
import math
try:
# from PDFPageDetailedAggregator:
from pdfminer.pdfdocument import PDFDocument, PDFNoOutlines
from pdfminer.pdfparser import PDFParser
from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter
from pdfminer.converter import PDFPageAggregator
... | 2.4375 | 2 |
ctrltest.py | dkim286/cpsc454-proj | 0 | 3286 | from pox.core import core
import pox.openflow.libopenflow_01 as of
from forwarding.l2_learning import *
from tkinter import *
from project.firewall import TestFW
from project.ui import UI
def setup():
top = Toplevel()
# quit POX when window is killed
top.protocol("WM_DELETE_WINDOW", core.quit)
t... | 2.5 | 2 |
virtual/lib/python3.6/site-packages/mako/__init__.py | kenmutuma001/Blog | 1 | 3287 | # mako/__init__.py
# Copyright (C) 2006-2016 the Mako authors and contributors <see AUTHORS file>
#
# This module is part of Mako and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
__version__ = '1.0.9'
| 0.933594 | 1 |
image_classification/T2T_ViT/load_pytorch_weights.py | RangeKing/PaddleViT | 0 | 3288 | <reponame>RangeKing/PaddleViT<filename>image_classification/T2T_ViT/load_pytorch_weights.py
# Copyright (c) 2021 PPViT 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 Licen... | 2.484375 | 2 |
estimators/__init__.py | j-bac/id-concentration | 0 | 3289 | <reponame>j-bac/id-concentration
from ._FisherS import randsphere, preprocessing, SeparabilityAnalysis, point_inseparability_to_pointID
from ._call_estimators import TwoNN, run_singleGMST,run_singleCorrDim,runDANCo, runDANCoStats, runDANColoop,runANOVAglobal,runANOVAlocal,radovanovic_estimators_matlab,Hidalgo
from ._DA... | 0.863281 | 1 |
examples/get_message.py | NeroAsmarr/fz-api | 71 | 3290 | # 获取调课、改课通知例子
from zfnew import GetInfo, Login
base_url = '学校教务系统的主页url'
lgn = Login(base_url=base_url)
lgn.login('账号', '密码')
cookies = lgn.cookies # cookies获取方法
person = GetInfo(base_url=base_url, cookies=cookies)
message = person.get_message()
print(message)
| 2.5 | 2 |
input/gera_entradas.py | AtilioA/Sort-merge-join | 0 | 3291 | import sys
import random
from faker import Faker
def gera(nLinhas=100, nCampos=None):
with open(f"{path}/file{nLinhas}-{nCampos}_python.txt", "w+", encoding="utf8") as file:
if not nCampos:
nCampos = random.randint(2, 10)
camposFuncs = [
fake.name,
fake.date,
... | 2.875 | 3 |
lessons 20/HomeWork/task9.py | zainllw0w/skillbox | 0 | 3292 | <reponame>zainllw0w/skillbox
def sort(data, time):
tt = False
ft = True
st = False
is_find = True
winers_name = set()
index = 0
while is_find:
index += 1
for key, values in data.items():
if time[0 - index] == int(values[1]) and ft and values[0] not in winers_name:... | 3.484375 | 3 |
src/test-apps/happy/test-templates/WeaveInetDNS.py | aiw-google/openweave-core | 1 | 3293 | #!/usr/bin/env python
#
# Copyright (c) 2016-2017 Nest Labs, Inc.
# 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/lice... | 2.125 | 2 |
funcoes.py | ZezaoDev/Circtrigo | 0 | 3294 | <reponame>ZezaoDev/Circtrigo
import turtle as t
import math
class circTrigo:
def __init__(self):
self.raio = 0
self.grau = 0
self.seno = 0
self.cosseno = 0
self.tangente = 0
self.quadrante = 0
self.tema = ''
t.bgcolor("black")
t.pencolor("wh... | 3.640625 | 4 |
examples/catapi/feeder.py | IniZio/py-skygear | 8 | 3295 | <gh_stars>1-10
def pick_food(name):
if name == "chima":
return "chicken"
else:
return "dry food"
| 2.96875 | 3 |
esm/model.py | crochereau/esm | 1 | 3296 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from .modules import (
TransformerLayer,
LearnedPosit... | 1.84375 | 2 |
python/tink/aead/kms_envelope_aead.py | bfloch/tink | 0 | 3297 | <reponame>bfloch/tink
# 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 or... | 2.34375 | 2 |
tests/pyb/can.py | LabAixBidouille/micropython | 0 | 3298 | from pyb import CAN
CAN.initfilterbanks(14)
can = CAN(1)
print(can)
can.init(CAN.LOOPBACK)
print(can)
print(can.any(0))
# Catch all filter
can.setfilter(0, CAN.MASK16, 0, (0, 0, 0, 0))
can.send('abcd', 123)
print(can.any(0))
print(can.recv(0))
can.send('abcd', -1)
print(can.recv(0))
can.send('abcd', 0x7FF + 1)
pr... | 2.28125 | 2 |
quarkchain/cluster/tests/test_miner.py | TahiG/pyquarkchain | 17 | 3299 | <filename>quarkchain/cluster/tests/test_miner.py
import asyncio
import time
import unittest
from typing import Optional
from quarkchain.cluster.miner import DoubleSHA256, Miner, MiningWork, validate_seal
from quarkchain.config import ConsensusType
from quarkchain.core import RootBlock, RootBlockHeader
from quarkchain.... | 2.34375 | 2 |