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 |
|---|---|---|---|---|---|---|
test/test_cursor_binding.py | rhlahuja/snowflake-connector-python | 0 | 4200 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2012-2018 Snowflake Computing Inc. All right reserved.
#
import pytest
from snowflake.connector.errors import (ProgrammingError)
def test_binding_security(conn_cnx, db_parameters):
"""
SQL Injection Tests
"""
try:
wit... | 2.828125 | 3 |
taln2016/icsisumm-primary-sys34_v1/nltk/nltk-0.9.2/nltk/model/__init__.py | hectormartinez/rougexstem | 0 | 4201 | # Natural Language Toolkit: Language Models
#
# Copyright (C) 2001-2008 University of Pennsylvania
# Author: <NAME> <<EMAIL>>
# URL: <http://nltk.sf.net>
# For license information, see LICENSE.TXT
class ModelI(object):
"""
A processing interface for assigning a probability to the next word.
"""
def __... | 3.15625 | 3 |
flask-graphene-sqlalchemy/models.py | JovaniPink/flask-apps | 0 | 4202 | import os
from graphene_sqlalchemy import SQLAlchemyObjectType
from sqlalchemy import Column, Integer, String, create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.ext.declarative import declarative_base
POSTGRES_CONNECTION_STRING = (
os.environ.get("POSTGRES_CONNECTION_STRING")
... | 2.546875 | 3 |
curlypiv/synthetics/microsig.py | sean-mackenzie/curlypiv | 0 | 4203 | # microsig
"""
Author: <NAME>
More detail about the MicroSIG can be found at:
Website:
https://gitlab.com/defocustracking/microsig-python
Publication:
Rossi M, Synthetic image generator for defocusing and astigmatic PIV/PTV, Meas. Sci. Technol., 31, 017003 (2020)
DOI:10.1088/1361-6501/ab42bb.
"""
import n... | 2.328125 | 2 |
planning/scenario_planning/lane_driving/motion_planning/obstacle_avoidance_planner/scripts/trajectory_visualizer.py | kmiya/AutowareArchitectureProposal.iv | 0 | 4204 | <gh_stars>0
# Copyright 2020 Tier IV, 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 t... | 2.375 | 2 |
main/forms.py | agokhale11/test2 | 0 | 4205 | from django.contrib.auth.forms import AuthenticationForm, UserCreationForm
from django.contrib.auth.models import User
from django import forms
class UploadFileForm(forms.Form):
title = forms.CharField(max_length=50)
file = forms.FileField()
# If you don't do this you cannot use Bootstrap CSS
class LoginFor... | 2.546875 | 3 |
pandas 9 - Statistics Information on data sets.py | PythonProgramming/Pandas-Basics-with-2.7 | 10 | 4206 | import pandas as pd
from pandas import DataFrame
df = pd.read_csv('sp500_ohlc.csv', index_col = 'Date', parse_dates=True)
df['H-L'] = df.High - df.Low
# Giving us count (rows), mean (avg), std (standard deviation for the entire
# set), minimum for the set, maximum for the set, and some %s in that range.
print( df.des... | 4.125 | 4 |
working/tkinter_widget/test.py | songdaegeun/school-zone-enforcement-system | 0 | 4207 | import cv2
import numpy as np
import threading
def test():
while 1:
img1=cv2.imread('captured car1.jpg')
print("{}".format(img1.shape))
print("{}".format(img1))
cv2.imshow('asd',img1)
cv2.waitKey(1)
t1 = threading.Thread(target=test)
t1.start()
| 3.015625 | 3 |
ceilometer/compute/virt/hyperv/utilsv2.py | aristanetworks/ceilometer | 2 | 4208 | # Copyright 2013 Cloudbase Solutions Srl
#
# Author: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
# 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.664063 | 2 |
src/cli.py | cajones314/avocd2019 | 0 | 4209 | # system
from io import IOBase, StringIO
import os
# 3rd party
import click
# internal
from days import DayFactory
# import logging
# logger = logging.getLogger(__name__)
# logger.setLevel(logging.DEBUG)
# ch = logging.StreamHandler()
# logger.addHandler(ch)
@click.group(invoke_without_command=True)
@click.option... | 2.625 | 3 |
option_c.py | wrosecrans/colormap | 231 | 4210 |
from matplotlib.colors import LinearSegmentedColormap
from numpy import nan, inf
# Used to reconstruct the colormap in viscm
parameters = {'xp': [-5.4895292543686764, 14.790571669586654, 82.5546687431056, 29.15531114139253, -4.1316769886951761, -13.002076438907238],
'yp': [-35.948168839230306, -42.27337... | 1.882813 | 2 |
RPI/yolov5/algorithm/planner/algorithms/hybrid_astar/draw/draw.py | Aditya239233/MDP | 4 | 4211 | <reponame>Aditya239233/MDP
import matplotlib.pyplot as plt
import numpy as np
import math
from algorithm.planner.utils.car_utils import Car_C
PI = np.pi
class Arrow:
def __init__(self, x, y, theta, L, c):
angle = np.deg2rad(30)
d = 0.3 * L
w = 2
x_start = x
y_start = y
... | 2.8125 | 3 |
models/database_models/comment_model.py | RuiCoreSci/Flask-Restful | 7 | 4212 | from sqlalchemy import Integer, Text, DateTime, func, Boolean, text
from models.database_models import Base, Column
class Comment(Base):
__tablename__ = "comment"
id = Column(Integer, primary_key=True, )
user_id = Column(Integer, nullable=False, comment="评论用户的 ID")
post_id = Column(Integer, nullable... | 2.75 | 3 |
aws_deploy/ecs/helper.py | jmsantorum/aws-deploy | 0 | 4213 | <reponame>jmsantorum/aws-deploy
import json
import re
from datetime import datetime
from json.decoder import JSONDecodeError
import click
from boto3.session import Session
from boto3_type_annotations.ecs import Client
from botocore.exceptions import ClientError, NoCredentialsError
from dateutil.tz.tz import tzlocal
fr... | 2.046875 | 2 |
sbm.py | emmaling27/networks-research | 0 | 4214 | <reponame>emmaling27/networks-research
import networkx as nx
from scipy.special import comb
import attr
@attr.s
class Count(object):
"""Count class with monochromatic and bichromatic counts"""
n = attr.ib()
monochromatic = attr.ib(default=0)
bichromatic = attr.ib(default=0)
def count_edge(self, u... | 2.828125 | 3 |
src/data/graph/ops/anagram_transform_op.py | PhilHarnish/forge | 2 | 4215 | from typing import Callable, Collection, Iterable, List, Union
from data.anagram import anagram_iter
from data.graph import _op_mixin, bloom_mask, bloom_node, bloom_node_reducer
Transformer = Callable[['bloom_node.BloomNode'], 'bloom_node.BloomNode']
_SPACE_MASK = bloom_mask.for_alpha(' ')
def merge_fn(
host: 'b... | 2.171875 | 2 |
gogapi/api.py | tikki/pygogapi | 23 | 4216 | <gh_stars>10-100
import json
import re
import logging
import html.parser
import zlib
import requests
from gogapi import urls
from gogapi.base import NotAuthorizedError, logger
from gogapi.product import Product, Series
from gogapi.search import SearchResult
DEBUG_JSON = False
GOGDATA_RE = re.compile(r"gogData\.?(.*?... | 2.21875 | 2 |
setup.py | gibsonMatt/stacks-pairwise | 0 | 4217 | import pathlib
import os
from setuptools import setup
# The directory containing this file
HERE = pathlib.Path(__file__).parent
# The text of the README file
README = (HERE / "README.md").read_text()
# specify requirements of your package here
REQUIREMENTS = ['biopython', 'numpy', 'pandas']
setup(name='stacksPairwi... | 1.5 | 2 |
csv_experiment.py | komax/spanningtree-crossingnumber | 2 | 4218 | <gh_stars>1-10
#! /usr/bin/env python
import os
import sys
args = sys.argv[1:]
os.system('python -O -m spanningtree.csv_experiment_statistics ' +
' '.join(args))
| 1.609375 | 2 |
projects/tutorials/object_nav_ithor_dagger_then_ppo_one_object.py | klemenkotar/dcrl | 18 | 4219 | <reponame>klemenkotar/dcrl<filename>projects/tutorials/object_nav_ithor_dagger_then_ppo_one_object.py<gh_stars>10-100
import torch
import torch.optim as optim
from torch.optim.lr_scheduler import LambdaLR
from allenact.algorithms.onpolicy_sync.losses import PPO
from allenact.algorithms.onpolicy_sync.losses.imitation i... | 1.984375 | 2 |
BioCAT/src/Calculating_scores.py | DanilKrivonos/BioCAT-nrp-BIOsynthesis-Caluster-Analyzing-Tool | 4 | 4220 | from numpy import array
from pickle import load
from pandas import read_csv
import os
from BioCAT.src.Combinatorics import multi_thread_shuffling, multi_thread_calculating_scores, make_combine, get_score, get_max_aminochain, skipper
# Importing random forest model
modelpath = os.path.dirname(os.path.abspath(__file__)... | 2.75 | 3 |
deal/linter/_extractors/returns.py | m4ta1l/deal | 1 | 4221 | <reponame>m4ta1l/deal
# built-in
from typing import Optional
# app
from .common import TOKENS, Extractor, Token, traverse
from .value import UNKNOWN, get_value
get_returns = Extractor()
inner_extractor = Extractor()
def has_returns(body: list) -> bool:
for expr in traverse(body=body):
if isinstance(exp... | 2.140625 | 2 |
qubiter/device_specific/chip_couplings_ibm.py | yourball/qubiter | 3 | 4222 | <reponame>yourball/qubiter
def aaa():
# trick sphinx to build link in doc
pass
# retired
ibmqx2_c_to_tars =\
{
0: [1, 2],
1: [2],
2: [],
3: [2, 4],
4: [2]
} # 6 edges
# retired
ibmqx4_c_to_tars =\
{
0: [],
1: [0],
2: [0, 1, 4],
3: [2, 4],
4: []
} # 6 edges
# retired
... | 1.703125 | 2 |
Template.py | rainshen49/citadel-trading-comp | 2 | 4223 | import signal
import requests
import time
from math import floor
shutdown = False
MAIN_TAKER = 0.0065
MAIN_MAKER = 0.002
ALT_TAKER = 0.005
ALT_MAKER = 0.0035
TAKER = (MAIN_TAKER + ALT_TAKER)*2
MAKER = MAIN_MAKER + ALT_MAKER
TAKEMAIN = MAIN_TAKER - ALT_MAKER
TAKEALT = ALT_TAKER - MAIN_MAKER
BUFFER = 0.0... | 2.71875 | 3 |
examples/basic/wire_feedthrough.py | souviksaha97/spydrnet-physical | 0 | 4224 | """
==========================================
Genrating feedthrough from single instance
==========================================
This example demostrates how to generate a feedthrough wire connection for
a given scalar or vector wires.
**Initial Design**
.. hdl-diagram:: ../../../examples/basic/_initial_design.v... | 2.53125 | 3 |
workflows/workflow.py | sunnyfloyd/panderyx | 0 | 4225 | from __future__ import annotations
from typing import Optional, Union
from tools import tools
from exceptions import workflow_exceptions
class Workflow:
"""A class to represent a workflow.
Workflow class provides set of methods to manage state of the workflow.
It allows for tool insertions, removals and... | 3.078125 | 3 |
team_fundraising/text.py | namtel-hp/fundraising-website | 5 | 4226 |
class Donation_text:
# Shown as a message across the top of the page on return from a donation
# used in views.py:new_donation()
thank_you = (
"Thank you for your donation. "
"You may need to refresh this page to see the donation."
)
confirmation_email_subject = (
'Thank y... | 2.765625 | 3 |
tests/wagtail_live/test_apps.py | wagtail/wagtail-live | 22 | 4227 | from django.apps import apps
from django.test import override_settings
from wagtail_live.signals import live_page_update
def test_live_page_update_signal_receivers():
assert len(live_page_update.receivers) == 0
@override_settings(
WAGTAIL_LIVE_PUBLISHER="tests.testapp.publishers.DummyWebsocketPublisher"
)
... | 1.710938 | 2 |
PLM/options.py | vtta2008/pipelineTool | 7 | 4228 | # -*- coding: utf-8 -*-
"""
Script Name:
Author: <NAME>/Jimmy - 3D artist.
Description:
"""
# -------------------------------------------------------------------------------------------------------------
""" Import """
import os
from PySide2.QtWidgets import (QFrame, QStyle, QAbstractItemView, QSizePolicy, ... | 1.640625 | 2 |
Crawling/ssafyCrawling.py | Nyapy/FMTG | 0 | 4229 | from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import sys
import time
import urllib.request
import os
sys.stdin = open('idpwd.txt')
site = input()
id = input()
pwd = input()
# selenium에서 사용할 웹 드라이버 절대 경로 정보
chromedriver = 'C:\Webdriver\chromedriver.exe'
# selenum의 webdriver에 앞서 설치... | 3.171875 | 3 |
100days/day95/StringIO_demo.py | chainren/python-learn | 0 | 4230 | <reponame>chainren/python-learn<gh_stars>0
from io import StringIO
# 定义一个 StringIO 对象,写入并读取其在内存中的内容
f = StringIO()
f.write('Python-100')
str = f.getvalue() # 读取写入的内容
print('写入内存中的字符串为:%s' %str)
f.write('\n') # 追加内容
f.write('坚持100天')
f.close() # 关闭
f1 = StringIO('Python-100' + '\n' + '坚持100天')
# 读取内容
print(f1.re... | 3.234375 | 3 |
tests/test_cli.py | Nate1729/FinPack | 1 | 4231 | """Contains tests for finpack/core/cli.py
"""
__copyright__ = "Copyright (C) 2021 <NAME>"
import os
import unittest
from importlib import metadata
from docopt import docopt
from finpack.core import cli
class TestCli(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.DATA_DIR = "temp"
... | 2.421875 | 2 |
python/Patterns/inheritance/main.py | zinderud/ysa | 0 | 4232 | class Yaratik(object):
def move_left(self):
print('Moving left...')
def move_right(self):
print('Moving left...')
class Ejderha(Yaratik):
def Ates_puskurtme(self):
print('ates puskurtum!')
class Zombie(Yaratik):
def Isirmak(self):
print('Isirdim simdi!')
enemy =... | 3.546875 | 4 |
clustering/graph_utils.py | perathambkk/ml-techniques | 0 | 4233 | """
Author: <NAME>
"""
import numpy as np
import pandas as pd
from sklearn.neighbors import NearestNeighbors
def affinity_graph(X):
'''
This function returns a numpy array.
'''
ni, nd = X.shape
A = np.zeros((ni, ni))
for i in range(ni):
for j in range(i+1, ni):
dist = ((X[i] - X[j])**2).sum() # compute ... | 3.375 | 3 |
recipe_engine/internal/commands/__init__.py | Acidburn0zzz/luci | 1 | 4234 | <gh_stars>1-10
# Copyright 2019 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
"""This package houses all subcommands for the recipe engine.
See implementation_details.md for the expectations of the modules in... | 1.976563 | 2 |
openfl/pipelines/stc_pipeline.py | sarthakpati/openfl | 0 | 4235 | <filename>openfl/pipelines/stc_pipeline.py
# Copyright (C) 2020-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""STCPipelinemodule."""
import numpy as np
import gzip as gz
from .pipeline import TransformationPipeline, Transformer
class SparsityTransformer(Transformer):
"""A transformer class to ... | 2.328125 | 2 |
tests/component/test_grid_mixin.py | csdms/pymt | 38 | 4236 | import numpy as np
import pytest
from pytest import approx
from pymt.component.grid import GridMixIn
class Port:
def __init__(self, name, uses=None, provides=None):
self._name = name
self._uses = uses or []
self._provides = provides or []
def get_component_name(self):
return ... | 2.125 | 2 |
scripts/compare.py | SnoozeTime/nes | 1 | 4237 | import sys
def load_log_sp(filename):
data = []
with open(filename) as f:
for line in f.readlines():
tokens = line.split(" ")
spidx = line.find("SP:")
endidx = line.find(' ', spidx)
data.append((line[0:4], line[spidx+3:endidx]))
return data
if __nam... | 2.796875 | 3 |
tercer_modelo.py | nahuelalmeira/deepLearning | 0 | 4238 | """Exercise 1
Usage:
$ CUDA_VISIBLE_DEVICES=2 python practico_1_train_petfinder.py --dataset_dir ../ --epochs 30 --dropout 0.1 0.1 --hidden_layer_sizes 200 100
To know which GPU to use, you can check it with the command
$ nvidia-smi
"""
import argparse
import os
import mlflow
import pickle
import numpy as np
impo... | 2.828125 | 3 |
catpy/applications/export.py | catmaid/catpy | 5 | 4239 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from pkg_resources import parse_version
from warnings import warn
from copy import deepcopy
import networkx as nx
from networkx.readwrite import json_graph
from catpy.applications.base import CatmaidClientApplication
NX_VERSION_INFO = parse_version(nx.... | 2.25 | 2 |
packages/watchmen-data-kernel/src/watchmen_data_kernel/meta/external_writer_service.py | Indexical-Metrics-Measure-Advisory/watchmen | 0 | 4240 | from typing import Optional
from watchmen_auth import PrincipalService
from watchmen_data_kernel.cache import CacheService
from watchmen_data_kernel.common import DataKernelException
from watchmen_data_kernel.external_writer import find_external_writer_create, register_external_writer_creator
from watchmen_meta.common... | 1.875 | 2 |
udemy-python/mediaponderada.py | AlbertoAlfredo/exercicios-cursos | 1 | 4241 | <reponame>AlbertoAlfredo/exercicios-cursos
nota1 = float(input('Digite a nota da primeira nota '))
peso1 = float(input('Digite o peso da primeira nota '))
nota2 = float(input('Digite a nota da seugundo nota '))
peso2 = float(input('Digite o peso da segundo nota '))
media = (nota1/peso1+nota2/peso2)/2
print('A média ... | 3.6875 | 4 |
scrywarden/module.py | chasebrewsky/scrywarden | 1 | 4242 | <reponame>chasebrewsky/scrywarden
from importlib import import_module
from typing import Any
def import_string(path: str) -> Any:
"""Imports a dotted path name and returns the class/attribute.
Parameters
----------
path: str
Dotted module path to retrieve.
Returns
-------
Class/a... | 2.65625 | 3 |
release/scripts/modules/bl_i18n_utils/utils_spell_check.py | dvgd/blender | 0 | 4243 | # ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... | 2.171875 | 2 |
naslib/predictors/mlp.py | gmeyerlee/NASLib | 0 | 4244 | <gh_stars>0
import numpy as np
import os
import json
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.utils.data import DataLoader, TensorDataset
from naslib.utils.utils import AverageMeterGroup
from naslib.predictors.utils.encodings import encode
from naslib.pr... | 2.390625 | 2 |
pythonforandroid/recipes/libx264/__init__.py | Joreshic/python-for-android | 1 | 4245 | from pythonforandroid.toolchain import Recipe, shprint, current_directory, ArchARM
from os.path import exists, join, realpath
from os import uname
import glob
import sh
class LibX264Recipe(Recipe):
version = 'x264-snapshot-20170608-2245-stable' # using mirror url since can't use ftp
url = 'http://mirror.yand... | 1.976563 | 2 |
Win/reg.py | QGB/QPSU | 6 | 4246 | #coding=utf-8
try:
if __name__.startswith('qgb.Win'):
from .. import py
else:
import py
except Exception as ei:
raise ei
raise EnvironmentError(__name__)
if py.is2():
import _winreg as winreg
from _winreg import *
else:
import winreg
from winreg import *
def get(skey,name,root=HKEY_CURRENT_USER,returnTyp... | 2.203125 | 2 |
tests/test_handler.py | CJSoldier/webssh | 13 | 4247 | <filename>tests/test_handler.py
import unittest
import paramiko
from tornado.httputil import HTTPServerRequest
from tests.utils import read_file, make_tests_data_path
from webssh.handler import MixinHandler, IndexHandler, InvalidValueError
class TestMixinHandler(unittest.TestCase):
def test_get_real_client_addr... | 2.359375 | 2 |
apps/notifications/tests/test_views.py | SCiO-systems/qcat | 0 | 4248 | <gh_stars>0
import logging
from unittest import mock
from unittest.mock import call
from django.conf import settings
from django.contrib.auth import get_user_model
from django.core.signing import Signer
from django.urls import reverse
from django.http import Http404
from django.test import RequestFactory
from braces.... | 2.140625 | 2 |
examples/resources.py | willvousden/clint | 1,230 | 4249 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import sys
import os
sys.path.insert(0, os.path.abspath('..'))
from clint import resources
resources.init('kennethreitz', 'clint')
lorem = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt... | 2.21875 | 2 |
photos/urls.py | charlesmugambi/Instagram | 0 | 4250 | from django.conf.urls import url
from django.conf import settings
from django.conf.urls.static import static
from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^image/$', views.add_image, name='upload_image'),
url(r'^profile/$', views.profile_info, name='profile'),
url(r'... | 1.90625 | 2 |
bread.py | vgfang/breadbot | 0 | 4251 | <reponame>vgfang/breadbot
import random
import math
from fractions import Fraction
from datetime import datetime
from jinja2 import Template
# empty class for passing to template engine
class Recipe:
def __init__(self):
return
# returns flour percent using flour type
def get_special_flour_percent(flourType: str, ... | 3.1875 | 3 |
posthog/api/test/test_organization_domain.py | msnitish/posthog | 0 | 4252 | import datetime
from unittest.mock import patch
import dns.resolver
import dns.rrset
import pytest
import pytz
from django.utils import timezone
from freezegun import freeze_time
from rest_framework import status
from posthog.models import Organization, OrganizationDomain, OrganizationMembership, Team
from posthog.te... | 2.28125 | 2 |
tutorial/test input.py | nataliapryakhina/FA_group3 | 0 | 4253 | import numpy as np
import tensorflow as tf
from tensorflow import keras
import matplotlib.pyplot as plt
from os import listdir
from tensorflow.keras.callbacks import ModelCheckpoint
dataDir = "./data/trainSmallFA/"
files = listdir(dataDir)
files.sort()
totalLength = len(files)
inputs = np.empty((len(files), 3, 64, 64)... | 2.328125 | 2 |
pepper/responder/brain.py | cltl/pepper | 29 | 4254 | <filename>pepper/responder/brain.py<gh_stars>10-100
from pepper.framework import *
from pepper import logger
from pepper.language import Utterance
from pepper.language.generation.thoughts_phrasing import phrase_thoughts
from pepper.language.generation.reply import reply_to_question
from .responder import Responder, R... | 2.5 | 2 |
fedora_college/modules/content/views.py | fedora-infra/fedora-college | 2 | 4255 | <filename>fedora_college/modules/content/views.py
# -*- coding: utf-8 -*-
import re
from unicodedata import normalize
from flask import Blueprint, render_template, current_app
from flask import redirect, url_for, g, abort
from sqlalchemy import desc
from fedora_college.core.database import db
from fedora_college.module... | 2.0625 | 2 |
tests/components/airthings/test_config_flow.py | MrDelik/core | 30,023 | 4256 | <reponame>MrDelik/core<filename>tests/components/airthings/test_config_flow.py
"""Test the Airthings config flow."""
from unittest.mock import patch
import airthings
from homeassistant import config_entries
from homeassistant.components.airthings.const import CONF_ID, CONF_SECRET, DOMAIN
from homeassistant.core impor... | 2.34375 | 2 |
utils/utils.py | scomup/StereoNet-ActiveStereoNet | 0 | 4257 | <reponame>scomup/StereoNet-ActiveStereoNet
# ------------------------------------------------------------------------------
# Copyright (c) NKU
# Licensed under the MIT License.
# Written by <NAME> (<EMAIL>)
# ------------------------------------------------------------------------------
import os
import torch
import t... | 2.15625 | 2 |
worker/main.py | Devalent/facial-recognition-service | 0 | 4258 | <reponame>Devalent/facial-recognition-service
from aiohttp import web
import base64
import io
import face_recognition
async def encode(request):
request_data = await request.json()
# Read base64 encoded image
url = request_data['image'].split(',')[1]
image = io.BytesIO(base64.b64decode(url))
# Lo... | 2.71875 | 3 |
rblod/setup.py | TiKeil/Two-scale-RBLOD | 0 | 4259 | # ~~~
# This file is part of the paper:
#
# " An Online Efficient Two-Scale Reduced Basis Approach
# for the Localized Orthogonal Decomposition "
#
# https://github.com/TiKeil/Two-scale-RBLOD.git
#
# Copyright 2019-2021 all developers. All rights reserved.
# License: Licensed as BSD 2-Clause ... | 1.382813 | 1 |
bin/euclid_fine_plot_job_array.py | ndeporzio/cosmicfish | 0 | 4260 | import os
import shutil
import numpy as np
import pandas as pd ... | 2.296875 | 2 |
project4/test/test_arm.py | XDZhelheim/CS205_C_CPP_Lab | 3 | 4261 | <reponame>XDZhelheim/CS205_C_CPP_Lab
import os
if __name__ == "__main__":
dims = ["32", "64", "128", "256", "512", "1024", "2048"]
for dim in dims:
os.system(
f"perf stat -e r11 -x, -r 10 ../matmul.out ../data/mat-A-{dim}.txt ../data/mat-B-{dim}.txt ./out/out-{dim}.txt 2>>res_arm.csv"
... | 2.0625 | 2 |
src/oci/apm_traces/models/query_result_row_type_summary.py | Manny27nyc/oci-python-sdk | 249 | 4262 | <reponame>Manny27nyc/oci-python-sdk<filename>src/oci/apm_traces/models/query_result_row_type_summary.py
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.... | 2.15625 | 2 |
jaxformer/hf/sample.py | salesforce/CodeGen | 105 | 4263 | <gh_stars>100-1000
# Copyright (c) 2022, salesforce.com, inc.
# All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause
# For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
import os
import re
import time
import random
import argparse
import torch
from t... | 2 | 2 |
tests/services/test_rover_runner_service.py | dev-11/mars-rover-challenge | 0 | 4264 | <reponame>dev-11/mars-rover-challenge
import unittest
from services import RoverRunnerService
from tests.test_environment.marses import small_mars_with_one_rover_empty_commands
from tests.test_environment import mocks as m
from data_objects import Rover
class TestRoverRunnerService(unittest.TestCase):
def test_r... | 2.609375 | 3 |
retrain_with_rotnet.py | ericdaat/self-label | 440 | 4265 | import argparse
import warnings
warnings.simplefilter("ignore", UserWarning)
import files
from tensorboardX import SummaryWriter
import os
import numpy as np
import time
import torch
import torch.optim
import torch.nn as nn
import torch.utils.data
import torchvision
import torchvision.transforms as tfs
from data impo... | 2.109375 | 2 |
tests/vie.py | Jinwithyoo/han | 0 | 4266 | # -*- coding: utf-8 -*-
from tests import HangulizeTestCase
from hangulize.langs.vie import Vietnamese
class VietnameseTestCase(HangulizeTestCase):
""" http://korean.go.kr/09_new/dic/rule/rule_foreign_0218.jsp """
lang = Vietnamese()
def test_1st(self):
"""제1항
nh는 이어지는 모음과 합쳐서 한 음절로 적는다.... | 2.59375 | 3 |
tests/test_functions/test_trig.py | jackromo/mathLibPy | 1 | 4267 | from mathlibpy.functions import *
import unittest
class SinTester(unittest.TestCase):
def setUp(self):
self.sin = Sin()
def test_call(self):
self.assertEqual(self.sin(0), 0)
def test_eq(self):
self.assertEqual(self.sin, Sin())
def test_get_derivative_call(self):
sel... | 3.40625 | 3 |
src/smallestLetter/target.py | rajitbanerjee/leetcode | 0 | 4268 | class Solution:
def nextGreatestLetter(self, letters: list, target: str) -> str:
if target < letters[0] or target >= letters[-1]:
return letters[0]
left, right = 0, len(letters) - 1
while left < right:
mid = left + (right - left) // 2
if letters[mid] > tar... | 3.546875 | 4 |
anti_cpdaily/command.py | hyx0329/nonebot_plugin_anti_cpdaily | 2 | 4269 | <reponame>hyx0329/nonebot_plugin_anti_cpdaily
import nonebot
from nonebot import on_command
from nonebot.rule import to_me
from nonebot.typing import T_State
from nonebot.adapters import Bot, Event
from nonebot.log import logger
from .config import global_config
from .schedule import anti_cpdaily_check_routine
cpdai... | 2.015625 | 2 |
matplotlib/gallery_python/pyplots/dollar_ticks.py | gottaegbert/penter | 13 | 4270 | <reponame>gottaegbert/penter
"""
============
Dollar Ticks
============
Use a `~.ticker.FormatStrFormatter` to prepend dollar signs on y axis labels.
"""
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
# Fixing random state for reproducibility
np.random.seed(19680801)
fig, ax = ... | 3.21875 | 3 |
Chibrary/utils.py | chiro2001/chibrary | 0 | 4271 | <reponame>chiro2001/chibrary
import json
import re
from flask import request, abort, jsonify
from Chibrary import config
from Chibrary.config import logger
from Chibrary.exceptions import *
from functools import wraps
from urllib import parse
from Chibrary.server import db
def parse_url_query(url: str) -> dict:
i... | 2.671875 | 3 |
tests/inputs/loops/51-arrays-in-loop.py | helq/pytropos | 4 | 4272 | import numpy as np
from something import Top
i = 0
while i < 10:
a = np.ndarray((10,4))
b = np.ones((10, Top))
i += 1
del Top
# show_store()
| 2.71875 | 3 |
tests/mappers/fields/test_float_field.py | Arfey/aiohttp_admin2 | 12 | 4273 | from aiohttp_admin2.mappers import Mapper
from aiohttp_admin2.mappers import fields
class FloatMapper(Mapper):
field = fields.FloatField()
def test_correct_float_type():
"""
In this test we check success convert to float type.
"""
mapper = FloatMapper({"field": 1})
mapper.is_valid()
ass... | 3.21875 | 3 |
autotest/t038_test.py | jdlarsen-UA/flopy | 2 | 4274 | <gh_stars>1-10
"""
Try to load all of the MODFLOW-USG examples in ../examples/data/mfusg_test.
These are the examples that are distributed with MODFLOW-USG.
"""
import os
import flopy
# make the working directory
tpth = os.path.join("temp", "t038")
if not os.path.isdir(tpth):
os.makedirs(tpth)
# build list of na... | 2.328125 | 2 |
botlib/cli.py | relikd/botlib | 0 | 4275 | #!/usr/bin/env python3
import os
from argparse import ArgumentParser, ArgumentTypeError, FileType, Namespace
from typing import Any
def DirType(string: str) -> str:
if os.path.isdir(string):
return string
raise ArgumentTypeError(
'Directory does not exist: "{}"'.format(os.path.abspath(string))... | 3.046875 | 3 |
pyhanko_certvalidator/asn1_types.py | MatthiasValvekens/certvalidator | 4 | 4276 | <filename>pyhanko_certvalidator/asn1_types.py
from typing import Optional
from asn1crypto import core, x509, cms
__all__ = [
'Target', 'TargetCert', 'Targets', 'SequenceOfTargets',
'AttrSpec', 'AAControls'
]
class TargetCert(core.Sequence):
_fields = [
('target_certificate', cms.IssuerSerial),
... | 2.109375 | 2 |
test/test_delete_group.py | ruslankl9/ironpython_training | 0 | 4277 | <filename>test/test_delete_group.py
from model.group import Group
import random
def test_delete_some_group(app):
if len(app.group.get_group_list()) <= 1:
app.group.add_new_group(Group(name='test'))
old_list = app.group.get_group_list()
index = random.randrange(len(old_list))
app.group.delete_g... | 2.734375 | 3 |
Evaluation/batch_detection.py | gurkirt/actNet-inAct | 27 | 4278 | <filename>Evaluation/batch_detection.py
'''
Autor: <NAME>
Start data: 15th May 2016
purpose: of this file is read frame level predictions and process them to produce a label per video
'''
from sklearn.svm import LinearSVC
from sklearn.ensemble import RandomForestClassifier
import numpy as np
import pickle
import os
im... | 2.375 | 2 |
python/csv/csv_dict_writer.py | y2ghost/study | 0 | 4279 | <filename>python/csv/csv_dict_writer.py
import csv
def csv_dict_writer(path, headers, data):
with open(path, 'w', newline='') as csvfile:
writer = csv.DictWriter(csvfile, delimiter=',',
fieldnames=headers)
writer.writeheader()
for record in data:
... | 3.890625 | 4 |
src/decisionengine/framework/modules/tests/test_module_decorators.py | moibenko/decisionengine | 9 | 4280 | <gh_stars>1-10
# SPDX-FileCopyrightText: 2017 Fermi Research Alliance, LLC
# SPDX-License-Identifier: Apache-2.0
import pytest
from decisionengine.framework.modules import Publisher, Source
from decisionengine.framework.modules.Module import verify_products
from decisionengine.framework.modules.Source import Paramete... | 2.046875 | 2 |
models/cnn_layer.py | RobinRojowiec/intent-recognition-in-doctor-patient-interviews | 0 | 4281 | import torch
import torch.nn as nn
from torch.nn.functional import max_pool1d
from utility.model_parameter import Configuration, ModelParameter
class CNNLayer(nn.Module):
def __init__(self, config: Configuration, vocab_size=30000, use_embeddings=True, embed_dim=-1, **kwargs):
super(CNNLayer, self).__init... | 2.6875 | 3 |
musicscore/musicxml/types/complextypes/backup.py | alexgorji/music_score | 2 | 4282 | '''
<xs:complexType name="backup">
<xs:annotation>
<xs:documentation></xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:group ref="duration"/>
<xs:group ref="editorial"/>
</xs:sequence>
</xs:complexType>
'''
from musicscore.dtd.dtd import Sequence, GroupReference, Element
from musicscore.musicxml... | 2.078125 | 2 |
NLP programmes in Python/9.Text Clustering/kmeans.py | AlexandrosPlessias/NLP-Greek-Presentations | 0 | 4283 | <filename>NLP programmes in Python/9.Text Clustering/kmeans.py
import nltk
import re
import csv
import string
import collections
import numpy as np
from nltk.corpus import wordnet
from nltk.corpus import stopwords
from nltk.stem import WordNetLemmatizer
from nltk.tokenize import WordPunctTokenizer
from sk... | 3.59375 | 4 |
common/utils.py | paTRICK-swk/P-STMO | 8 | 4284 | import torch
import numpy as np
import hashlib
from torch.autograd import Variable
import os
def deterministic_random(min_value, max_value, data):
digest = hashlib.sha256(data.encode()).digest()
raw_value = int.from_bytes(digest[:4], byteorder='little', signed=False)
return int(raw_value / (2 ** 32 - 1... | 2.125 | 2 |
personal_ad/advice/converter.py | Sailer43/CSE5914Project | 0 | 4285 | <gh_stars>0
from ibm_watson import TextToSpeechV1, SpeechToTextV1, DetailedResponse
from os import system
from json import loads
class Converter:
k_s2t_api_key = "<KEY>"
k_t2s_api_key = "<KEY>"
k_s2t_url = "https://stream.watsonplatform.net/speech-to-text/api"
k_t2s_url = "https://gateway-wdc.watson... | 3.109375 | 3 |
warg_client/client/apis/controller/attack_controller.py | neel4os/warg-client | 0 | 4286 | <gh_stars>0
from subprocess import run
def perform_shutdown(body):
arg = ""
if body["reboot"]:
_is_reboot = arg + "-r"
else:
_is_reboot = arg + "-h"
time_to_shutdown = str(body['timeToShutdown'])
result = run(["/sbin/shutdown", _is_reboot, time_to_shutdown])
return body
| 2.640625 | 3 |
torrents/migrations/0011_auto_20190223_2345.py | 2600box/harvest | 9 | 4287 | <reponame>2600box/harvest<filename>torrents/migrations/0011_auto_20190223_2345.py
# Generated by Django 2.1.7 on 2019-02-23 23:45
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('torrents', '0010_auto_20190223_0326'),
]
operations = [
migrations... | 1.40625 | 1 |
common/__init__.py | whyh/FavourDemo | 1 | 4288 | <filename>common/__init__.py
from . import (emoji as emj,
keyboards as kb,
telegram as tg,
phrases as phr,
finance as fin,
utils,
glossary,
bots,
gcp,
sed,
db)
| 1.242188 | 1 |
questions/serializers.py | aneumeier/questions | 0 | 4289 | <filename>questions/serializers.py
#!/usr/bin/env python
# -*- coding: utf-8
"""
:mod:`question.serializers` -- serializers
"""
from rest_framework import serializers
from .models import Question, PossibleAnswer
from category.models import Category
class PossibleAnswerSerializer(serializers.ModelSerializer):
cl... | 2.609375 | 3 |
widgets/ui_ShowResultDialog.py | JaySon-Huang/SecertPhotos | 0 | 4290 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'src/ui_ShowResultDialog.ui'
#
# Created: Sat May 16 17:05:43 2015
# by: PyQt5 UI code generator 5.4
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):
def s... | 1.664063 | 2 |
mixcoatl/admin/api_key.py | zomGreg/mixcoatl | 0 | 4291 | <gh_stars>0
"""
mixcoatl.admin.api_key
----------------------
Implements access to the DCM ApiKey API
"""
from mixcoatl.resource import Resource
from mixcoatl.decorators.lazy import lazy_property
from mixcoatl.decorators.validations import required_attrs
from mixcoatl.utils import uncamel, camelize, camel_keys, uncame... | 2.140625 | 2 |
Python tests/dictionaries.py | Johnny-QA/Python_training | 0 | 4292 | <reponame>Johnny-QA/Python_training<filename>Python tests/dictionaries.py
my_set = {1, 3, 5}
my_dict = {'name': 'Jose', 'age': 90}
another_dict = {1: 15, 2: 75, 3: 150}
lottery_players = [
{
'name': 'Rolf',
'numbers': (13, 45, 66, 23, 22)
},
{
'name': 'John',
'numbers': (14,... | 3.09375 | 3 |
psdaq/psdaq/control_gui/QWTable.py | ZhenghengLi/lcls2 | 16 | 4293 | <reponame>ZhenghengLi/lcls2
"""Class :py:class:`QWTable` is a QTableView->QWidget for tree model
======================================================================
Usage ::
# Run test: python lcls2/psdaq/psdaq/control_gui/QWTable.py
from psdaq.control_gui.QWTable import QWTable
w = QWTable()
Create... | 2.171875 | 2 |
src/grailbase/mtloader.py | vadmium/grailbrowser | 9 | 4294 | """Extension loader for filetype handlers.
The extension objects provided by MIMEExtensionLoader objects have four
attributes: parse, embed, add_options, and update_options. The first two
are used as handlers for supporting the MIME type as primary and embeded
resources. The last two are (currently) only used for pr... | 2.484375 | 2 |
eventstreams_sdk/adminrest_v1.py | IBM/eventstreams-python-sdk | 2 | 4295 | <gh_stars>1-10
# coding: utf-8
# (C) Copyright IBM Corp. 2021.
#
# 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 appl... | 1.679688 | 2 |
3-functions/pytest-exercises/test_functions.py | BaseCampCoding/python-fundamentals | 0 | 4296 | <filename>3-functions/pytest-exercises/test_functions.py
import functions
from pytest import approx
from bcca.test import should_print
def test_add_em_up():
assert functions.add_em_up(1, 2, 3) == 6
assert functions.add_em_up(4, 5, 6) == 15
def test_sub_sub_hubbub():
assert functions.sub_sub_hubbub(1, 2,... | 3.46875 | 3 |
src/products/admin.py | apabaad/django_ecommerce | 0 | 4297 | <reponame>apabaad/django_ecommerce
from django.contrib import admin
from .models import Product
admin.site.register(Product) | 1.203125 | 1 |
cio/plugins/txt.py | beshrkayali/content-io | 6 | 4298 | <reponame>beshrkayali/content-io
# coding=utf-8
from __future__ import unicode_literals
from .base import BasePlugin
class TextPlugin(BasePlugin):
ext = 'txt'
| 1.234375 | 1 |
ml-scripts/dump-data-to-learn.py | thejoeejoee/SUI-MIT-VUT-2020-2021 | 0 | 4299 | #!/usr/bin/env python3
# Project: VUT FIT SUI Project - Dice Wars
# Authors:
# - <NAME> <<EMAIL>>
# - <NAME> <<EMAIL>>
# - <NAME> <<EMAIL>>
# - <NAME> <<EMAIL>>
# Year: 2020
# Description: Generates game configurations.
import random
import sys
from argparse import ArgumentParser
import time
from... | 2.40625 | 2 |