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 |
|---|---|---|---|---|---|---|
serde/src/gen/thrift/gen-py/megastruct/ttypes.py | amCharlie/hive | 2 | 1100 | <filename>serde/src/gen/thrift/gen-py/megastruct/ttypes.py
#
# Autogenerated by Thrift Compiler (0.13.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
# options string: py
#
from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException
from thrift.protocol.TPro... | 1.992188 | 2 |
gpMgmt/bin/gpload_test/gpload2/TEST.py | Tylarb/gpdb | 1 | 1101 | <gh_stars>1-10
#!/usr/bin/env python
import unittest
import sys
import os
import string
import time
import socket
import fileinput
import platform
import re
try:
import subprocess32 as subprocess
except:
import subprocess
import pg
def get_port_from_conf():
file = os.environ.get('MASTER_DATA_DIRECTORY')+'... | 2.453125 | 2 |
code_week19_831_96/biao_shi_shu_zi.py | dylanlee101/leetcode | 0 | 1102 | <filename>code_week19_831_96/biao_shi_shu_zi.py
'''
请实现一个函数用来判断字符串是否表示数值(包括整数和小数)。例如,字符串"+100"、"5e2"、"-123"、"3.1416"、"-1E-16"、"0123"都表示数值,但"12e"、"1a3.14"、"1.2.3"、"+-5"及"12e+5.4"都不是。
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/biao-shi-shu-zhi-de-zi-fu-chuan-lcof
'''
class Solution:
def isNumber(self, s: s... | 2.859375 | 3 |
teeth_overlord/tests/unit/networks/neutron.py | rackerlabs/teeth-overlord | 0 | 1103 | <reponame>rackerlabs/teeth-overlord
"""
Copyright 2013 Rackspace, 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 l... | 1.390625 | 1 |
classes/settings.py | johnyburd/glucometer | 12 | 1104 | def init():
global brightness
global calibration_mode
brightness = 500
calibration_mode = False
| 1.414063 | 1 |
typeidea/blog/views.py | Phoenix-sy/typeidea | 0 | 1105 | from datetime import date
from django.core.cache import cache
from django.db.models import Q, F
from django.shortcuts import render
from django.shortcuts import get_object_or_404
from django.views.generic import ListView, DetailView
#from silk.profiling.profiler import silk_profile
from config.models import SideBar
f... | 2 | 2 |
VMI/VMItest.py | thomasbarillot/DAQ | 1 | 1106 | <reponame>thomasbarillot/DAQ
# -*- coding: utf-8 -*-
"""
Created on Sat May 7 11:38:18 2016
@author: thomasbarillot
VMI control
"""
from ctypes import cdll
#slib="VMIcrtl_ext.dll"
#hlib=cdll('VMIcrtl.dll')
import VMIcrtl_ext
test=VMIcrtl_ext.VMIcrtl()
#%%
print test.GetFilename()
#%%
test.setFilename('20161115_1... | 1.851563 | 2 |
var/spack/repos/builtin/packages/openssl/package.py | vitodb/spack | 0 | 1107 | <filename>var/spack/repos/builtin/packages/openssl/package.py
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import llnl.util.tty as tty
from spack import *
import spac... | 1.359375 | 1 |
vispy/util/profiler.py | izaid/vispy | 0 | 1108 | # -*- coding: utf-8 -*-
# Copyright (c) 2014, Vispy Development Team.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# Adapted from PyQtGraph
import sys
from . import ptime
from .. import config
class Profiler(object):
"""Simple profiler allowing directed, hierarchical measurement of ti... | 2.859375 | 3 |
tests/test_processor.py | vijithv/djangosaml2idp | 1 | 1109 | from django.contrib.auth import get_user_model
from djangosaml2idp.processors import BaseProcessor
User = get_user_model()
class TestBaseProcessor:
def test_extract_user_id_configure_by_user_class(self):
user = User()
user.USERNAME_FIELD = 'email'
user.email = 'test_email'
asse... | 2.53125 | 3 |
com/ds/SingleLinkedList.py | sasikrishna/python-programs | 0 | 1110 |
class Node:
def __init__(self, data):
self.data = data
self.prev = None
self.next = None
class SingleLinkedList:
def __init__(self):
self.head = None
def add(self, ele):
new_node = Node(ele)
if self.head is None:
self.head = new_node
... | 3.75 | 4 |
src/data_setup/__init__.py | data-stories/chart-experiment | 0 | 1111 | __all__ = ["data_setup", "chart_params", "base_params"] | 1.09375 | 1 |
src/aiocomcrawl/models.py | rudaporto/aiocomcrawl | 0 | 1112 | from datetime import datetime
from typing import Any, List, Optional, Union
from pydantic import BaseModel, Field, HttpUrl, validator
from pydantic.dataclasses import dataclass
class Index(BaseModel):
id: str
name: str
time_gate: HttpUrl = Field(alias="timegate")
cdx_api: HttpUrl = Field(alias="cdx-a... | 2.5 | 2 |
fs/error_tools.py | EnjoyLifeFund/macHighSierra-py36-pkgs | 0 | 1113 | <gh_stars>0
"""Tools for managing OS errors.
"""
from __future__ import print_function
from __future__ import unicode_literals
import errno
from contextlib import contextmanager
import sys
import platform
from . import errors
from six import reraise
_WINDOWS_PLATFORM = platform.system() == 'Windows'
class _Conv... | 2.171875 | 2 |
samples/samplenetconf/demos/vr_demo3.py | gaberger/pysdn | 1 | 1114 | <gh_stars>1-10
#!/usr/bin/python
# Copyright (c) 2015, BROCADE COMMUNICATIONS SYSTEMS, INC
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the ab... | 1.585938 | 2 |
python/index.py | stijnvanhulle/EscapeGame | 1 | 1115 | <gh_stars>1-10
# @Author: <NAME> <stijnvanhulle>
# @Date: 2016-11-28T13:51:38+01:00
# @Email: <EMAIL>
# @Last modified by: stijnvanhulle
# @Last modified time: 2016-12-20T12:51:07+01:00
# @License: stijnvanhulle.be
#!/usr/bin/env python
import time
import datetime
import math
import sys
import json
import paho... | 2.21875 | 2 |
Codility/python/tape_equilibrium.py | ajeet1308/code_problems | 61 | 1116 | def solution(A):
total = sum(A)
m = float('inf')
left_sum = 0
for n in A[:-1]:
left_sum += n
v = abs(total - 2*left_sum)
if v < m:
m = v
return m
| 3.234375 | 3 |
peps/converters.py | idjaw/pythondotorg | 0 | 1117 | import re
import os
from bs4 import BeautifulSoup
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.files import File
from pages.models import Page, Image
PEP_TEMPLATE = 'pages/pep-page.html'
pep_url = lambda num: 'dev/peps/pep-{}/'.format(num)
def check_pat... | 2.296875 | 2 |
venv/Lib/site-packages/toolz/sandbox/__init__.py | ajayiagbebaku/NFL-Model | 3,749 | 1118 | from .core import EqualityHashKey, unzip
from .parallel import fold
| 1.148438 | 1 |
interface/app/__init__.py | caglorithm/accel | 31 | 1119 | from flask import Flask
app = Flask(__name__, static_folder='static')
from app import routes
| 1.578125 | 2 |
implementations/python3/tests/CAPDU.py | sebastien-riou/SATL | 4 | 1120 | <reponame>sebastien-riou/SATL
import os
import pysatl
from pysatl import CAPDU
if __name__ == "__main__":
def check(hexstr, expected):
capdu = CAPDU.from_hexstr(hexstr)
if capdu != expected:
raise Exception("Mismatch for input '"+hexstr+"'\nActual: "+str(capdu)+"\nExpected: "+str(e... | 2.84375 | 3 |
src/mgls_bootstrapping.py | rosich/mgls | 0 | 1121 | <filename>src/mgls_bootstrapping.py
#!/usr/bin/python
from math import sin, cos, tan, atan, pi, acos, sqrt, exp, log10
import sys, os
import copy
import random
import numpy as np
import multiprocessing as mp
import ConfigParser
sys.path.append('./bin')
import mGLS, mMGLS
sys.path.append('./src')
from EnvGlobals import ... | 2.171875 | 2 |
mgmt/src/constants.py | pcaruana/sombrio | 0 | 1122 | #! /usr/bin/env python3
"""
constants.py - Contains all constants used by the device manager
Author:
- <NAME> (<EMAIL> at <EMAIL> dot <EMAIL>)
Date: 12/3/2016
"""
number_of_rows = 3 # total number rows of Index Servers
number_of_links = 5 # number of links to be sent to Cra... | 1.242188 | 1 |
XDoG/XDoG.py | STomoya/sketchify | 0 | 1123 | <filename>XDoG/XDoG.py
import cv2
import numpy as np
def DoG(image, size, sigma, k=1.6, gamma=1.):
g1 = cv2.GaussianBlur(image, (size, size), sigma)
g2 = cv2.GaussianBlur(image, (size, size), sigma*k)
return g1 - gamma * g2
def XDoG(image, size, sigma, eps, phi, k=1.6, gamma=1.):
eps /= 255
d = D... | 2.6875 | 3 |
lm/validate.py | ericlin8545/grover | 864 | 1124 | <reponame>ericlin8545/grover
# Original work Copyright 2018 The Google AI Language Team Authors.
# Modified work Copyright 2019 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ... | 1.835938 | 2 |
robo/fmin/entropy_search.py | fuhuifang/RoBo | 0 | 1125 | import logging
import george
import numpy as np
from robo.priors.default_priors import DefaultPrior
from robo.models.gaussian_process import GaussianProcess
from robo.models.gaussian_process_mcmc import GaussianProcessMCMC
from robo.maximizers.random_sampling import RandomSampling
from robo.maximizers.scipy_optimizer ... | 2.453125 | 2 |
biserici_inlemnite/app/migrations/0096_bisericapage_datare_an.py | ck-tm/biserici-inlemnite | 0 | 1126 | # Generated by Django 3.1.13 on 2021-10-29 11:07
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0095_bisericapage_utitle'),
]
operations = [
migrations.AddField(
model_name='bisericapage',
name='datare_an... | 1.507813 | 2 |
services/core-api/app/api/mms_now_submissions/models/surface_bulk_sample_activity.py | bcgov/mds | 25 | 1127 | <reponame>bcgov/mds
from app.api.utils.models_mixins import Base
from app.extensions import db
class MMSSurfaceBulkSampleActivity(Base):
__tablename__ = "surface_bulk_sample_activity"
__table_args__ = {"schema": "mms_now_submissions"}
id = db.Column(db.Integer, primary_key=True)
messageid = db.Column(... | 1.96875 | 2 |
lgtv_rs232/commands/remote_control/remote_control_lock.py | davo22/lgtv_rs232 | 0 | 1128 | from enum import Enum
class RemoteControlLock(Enum):
OFF = 0
ON = 1
def map_to_state(data: int):
return RemoteControlLock(data)
class RemoteControlLockCommands(object):
_command = "km"
def __init__(self, send_command):
self._send_command = send_command
async def get_state(self):
... | 3.109375 | 3 |
com/bridgelabz/programs/powerof2.py | aashishogale/FunctionalPrograms-Python- | 0 | 1129 | <reponame>aashishogale/FunctionalPrograms-Python-
import sys
from com.bridgelabz.utility.Utility import Utility
class PowerOf2:
def start(self):
number=int(sys.argv[1])
print(number)
for i in Utility().powerof2(number):
print(i)
return
PowerOf2().start() | 3.09375 | 3 |
app/main.py | MichaelLeeman/Job_Web_Scraper | 0 | 1130 | <filename>app/main.py<gh_stars>0
# This program scraps data from job postings on the website workinstartups.com and appends it to an excel worksheet.
import os
from datetime import datetime, timedelta
from selenium import webdriver
from app import web_scraper
from app import excel
job_list, last_date = [], None
file_... | 3.46875 | 3 |
src/trusted/validator_arm/dgen_output.py | kapkic/native_client | 1 | 1131 | #!/usr/bin/python2
#
# Copyright (c) 2012 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
"""
Some common boilerplates and helper functions for source code generation
in files dgen_test_output.py and dgen_decode_out... | 2.8125 | 3 |
src/data_loader/input_data_loader.py | ChristopherBrix/Debona | 2 | 1132 |
"""
Functions for loading input data.
Author: <NAME> <<EMAIL>>
"""
import os
import numpy as np
def load_img(path: str, img_nums: list, shape: tuple) -> np.array:
"""
Loads a image in the human-readable format.
Args:
path:
The path to the to the folder with mnist images.
i... | 3.625 | 4 |
ui_splash_screen.py | hirokiyaginuma/scriptspinner-software | 0 | 1133 | <reponame>hirokiyaginuma/scriptspinner-software
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'splash_screen.ui'
##
## Created by: Qt User Interface Compiler version 5.15.1
##
## WARNING! All changes made in this file wil... | 2.203125 | 2 |
pandas/io/sql.py | danbirken/pandas | 0 | 1134 | <gh_stars>0
"""
Collection of query wrappers / abstractions to both facilitate data
retrieval and to reduce dependency on DB-specific API.
"""
from __future__ import print_function, division
from datetime import datetime, date, timedelta
import warnings
import traceback
import itertools
import re
import numpy as np
i... | 2.5 | 2 |
Dataset/Leetcode/train/58/28.py | kkcookies99/UAST | 0 | 1135 | <filename>Dataset/Leetcode/train/58/28.py
class Solution:
def XXX(self, s):
"""
:type s: str
:rtype: int
"""
cnt, tail = 0, len(s) - 1
while tail >= 0 and s[tail] == ' ':
tail -= 1
while tail >= 0 and s[tail] != ' ':
cnt += 1
... | 2.9375 | 3 |
Systerm/meta.py | ZytroCode/Systerm | 1 | 1136 | <gh_stars>1-10
"""Meta is a module contains objects that will customize the behavior of python."""
from abc import ABC
from abc import ABCMeta
from abc import abstractmethod
from typing import Any
from typing import Callable
import Systerm
# Metaclass
class Metaclass(ABCMeta):
"""A metaclass to customize the beha... | 3.765625 | 4 |
samples/apps/txregulator/tests/txregulatorclient.py | iqsarv/CCF | 1 | 1137 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the Apache 2.0 License.
import infra.e2e_args
import infra.ccf
import infra.jsonrpc
import logging
from time import gmtime, strftime
import csv
import random
from loguru import logger as LOG
class AppUser:
def __init__(self, network, n... | 2.046875 | 2 |
src/finmag/sim/hysteresis.py | davidcortesortuno/finmag | 10 | 1138 | <reponame>davidcortesortuno/finmag
import os
import re
import glob
import logging
import textwrap
import fileinput
import numpy as np
from finmag.energies import Zeeman
from finmag.util.helpers import norm
log = logging.getLogger(name="finmag")
def hysteresis(sim, H_ext_list, fun=None, **kwargs):
"""
Set the... | 2.6875 | 3 |
uiSetup.py | smokedpirate/Encryption-hash-generator | 4 | 1139 | <reponame>smokedpirate/Encryption-hash-generator<gh_stars>1-10
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5 import QtGui, QtCore
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(577, 341)
palette = QtGui... | 2.234375 | 2 |
yxtx/myApp/migrations/0017_chat.py | wjh112233/yxtx | 0 | 1140 | # Generated by Django 3.0.2 on 2020-03-17 08:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('myApp', '0016_usergroup_buyer'),
]
operations = [
migrations.CreateModel(
name='Chat',
fields=[
('id... | 1.976563 | 2 |
core/controllers/services.py | willingc/oh-missions-oppia-beta | 0 | 1141 | # Copyright 2012 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/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | 2.390625 | 2 |
convoy/crypto.py | hebinhuang/batch-shipyard | 0 | 1142 | <filename>convoy/crypto.py
# Copyright (c) Microsoft Corporation
#
# All rights reserved.
#
# MIT License
#
# 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 with... | 1.726563 | 2 |
libs/configs/COCO/cfgs_res50_1x_coco_v3.py | lj-ecjtu/Cascade_FPN_Tensorflow-master | 43 | 1143 | # -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import
import os
import tensorflow as tf
'''
gluoncv backbone + multi_gpu
'''
# ------------------------------------------------
VERSION = 'Cascade_FPN_Res50_COCO_1x_20190421_v3'
NET_NAME = 'resnet50_v1d'
ADD_BOX_IN_TENSORBOARD = True
... | 2.03125 | 2 |
python/delta/tests/test_exceptions.py | vibhaska/delta | 1 | 1144 | <gh_stars>1-10
#
# Copyright (2020) The Delta Lake Project 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 appli... | 1.796875 | 2 |
day10/samematrix.py | nikhilsamninan/python-files | 0 | 1145 | def matrix_form():
r = int(input("Enter the no of rows"))
c = int(input("Enter the no of columns"))
matrix=[]
print("Enter the enteries")
for i in range(r):
a = []
for j in range(c):
a.append(int(input()))
matrix.append(a)
return(matrix)
def check_matrix(fi... | 3.921875 | 4 |
extractFeatures.py | PatrickJReed/Longboard | 1 | 1146 | #!/home/ubuntu/miniconda2/bin/python
from __future__ import division
import sys
import glob, os, gc
import uuid
import os.path
import csv
import numpy as np
from time import time
from subprocess import (call, Popen, PIPE)
from itertools import product
import shutil
import re
import pickle
from boto3.session import Ses... | 1.84375 | 2 |
kepler.py | mdbernard/astrodynamics | 0 | 1147 | import numpy as np
from stumpff import C, S
from CelestialBody import BODIES
from numerical import newton, laguerre
from lagrange import calc_f, calc_fd, calc_g, calc_gd
def kepler_chi(chi, alpha, r0, vr0, mu, dt):
''' Kepler's Equation of the universal anomaly, modified
for use in numerical solvers. '''
... | 2.640625 | 3 |
nicos_demo/vpgaa/setups/pgai.py | jkrueger1/nicos | 12 | 1148 | description = 'PGAA setup with XYZOmega sample table'
group = 'basic'
sysconfig = dict(
datasinks = ['mcasink', 'chnsink', 'csvsink', 'livesink']
)
includes = [
'system',
'reactor',
'nl4b',
'pressure',
'sampletable',
'pilz',
'detector',
'collimation',
]
devices = dict(
mcasin... | 1.898438 | 2 |
tests/python/relay/test_op_level2.py | ravikumarvc/incubator-tvm | 3 | 1149 | <gh_stars>1-10
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License")... | 1.703125 | 2 |
official/nlp/transformer/utils/tokenizer_test.py | hjkim-haga/TF-OD-API | 1 | 1150 | # Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | 2.515625 | 3 |
api/api/form7_searching_utils/__init__.py | bcgov/court-of-appeal | 0 | 1151 | <filename>api/api/form7_searching_utils/__init__.py
from .form7_search import Form7Search
from .parse_form7 import Form7Parsing
| 1.09375 | 1 |
soil/build/lib/soil/openstack/snapshot.py | JackDan9/soil | 1 | 1152 | <gh_stars>1-10
# Copyright 2020 Soil, Inc.
from soil.openstack.base import DataBase
from soil.openstack.base import SourceBase
class SnapshotData(DataBase):
"""A class for openstack snapshot data"""
def __init__(self, data):
self.data = data['snapshot']
class Snapshot(SourceBase):
"""A cla... | 2.390625 | 2 |
Z - Tool Box/LaZagne/Windows/lazagne/softwares/windows/ppypykatz.py | dfirpaul/Active-Directory-Exploitation-Cheat-Sheet-1 | 1,290 | 1153 | # -*- coding: utf-8 -*-
# Thanks to @skelsec for his awesome tool Pypykatz
# Checks his project here: https://github.com/skelsec/pypykatz
import codecs
import traceback
from lazagne.config.module_info import ModuleInfo
from lazagne.config.constant import constant
from pypykatz.pypykatz import pypykatz
... | 2.09375 | 2 |
test/test_discogs.py | mglukhovsky/beets | 0 | 1154 | <filename>test/test_discogs.py
# -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2016, <NAME>.
#
# 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... | 2.359375 | 2 |
data_structures/queue/queue_on_pseudo_stack.py | hank-chou/python | 13 | 1155 | <filename>data_structures/queue/queue_on_pseudo_stack.py
"""Queue represented by a pseudo stack (represented by a list with pop and append)"""
class Queue:
def __init__(self):
self.stack = []
self.length = 0
def __str__(self):
printed = "<" + str(self.stack)[1:-1] + ">"
return... | 4.1875 | 4 |
darknet2ncnn.py | nihui/gen-ncnn-models | 4 | 1156 | <reponame>nihui/gen-ncnn-models
#! /usr/bin/env python
# coding: utf-8
import configparser
import numpy as np
import re,sys,os
from graph import MyGraph
from collections import OrderedDict
def unique_config_sections(config_file):
"""Convert all config sections to have unique names.
Adds unique suffixes to co... | 2.453125 | 2 |
music/models.py | anirudha-bs/Django_music_app | 0 | 1157 | from django.contrib.auth.models import Permission, User
from django.db import models
class Album(models.Model):
user = models.ForeignKey(User, default=1,on_delete=models.CASCADE)
artist = models.CharField(max_length=250)
album_title = models.CharField(max_length=500)
genre = models.CharField(max_lengt... | 2.515625 | 3 |
finex_history.py | yihming/gdax-data | 0 | 1158 | <filename>finex_history.py
import datetime
import calendar
import requests
import pandas as pd
import json
import os.path
import time
import MySQLdb as M
from gdax_history import timestamp_to_utcstr
def connect_to_db():
config = json.load(open('dbconn.json'))["mysql"]
db = M.connect(host = config["host"],
... | 2.578125 | 3 |
src/producers/connector.py | cvelas31/public_transportation_streaming | 0 | 1159 | """Configures a Kafka Connector for Postgres Station data"""
import json
import logging
import requests
from settings import Settings
logger = logging.getLogger(__name__)
KAFKA_CONNECT_URL = f"{Settings.URLs.KAFKA_CONNECT_URL}/connectors"
CONNECTOR_NAME = "stations"
def configure_connector():
"""Starts and co... | 3.109375 | 3 |
liuetal2019/utils.py | wasiahmad/GATE | 24 | 1160 | import io
import logging
import json
import numpy
import torch
import numpy as np
from tqdm import tqdm
from clie.inputters import constant
from clie.objects import Sentence
from torch.utils.data import Dataset
from torch.utils.data.sampler import Sampler
logger = logging.getLogger(__name__)
def load_word_embeddings... | 2.3125 | 2 |
build.py | dnanexus/IndexTools | 15 | 1161 | from distutils.extension import Extension
cmdclass = {}
try:
# with Cython
from Cython.Build import build_ext
cmdclass["build_ext"] = build_ext
module_src = "cgranges/python/cgranges.pyx"
except ImportError: # without Cython
module_src = "cgranges/python/cgranges.c"
def build(setup_kwargs):
... | 1.976563 | 2 |
icarus/models/service/__init__.py | oascigil/icarus_edge_comp | 5 | 1162 | <filename>icarus/models/service/__init__.py<gh_stars>1-10
# -*- coding: utf-8 -*-
from .compSpot import *
| 1.023438 | 1 |
gluoncv/data/kinetics400/classification.py | YvetteGuo/gluon-cv | 1 | 1163 | <reponame>YvetteGuo/gluon-cv<filename>gluoncv/data/kinetics400/classification.py
# pylint: disable=line-too-long,too-many-lines,missing-docstring
"""Kinetics400 action classification dataset."""
import os
import random
import numpy as np
from mxnet import nd
from mxnet.gluon.data import dataset
__all__ = ['Kinetics400... | 2.71875 | 3 |
qf_lib/containers/futures/future_contract.py | webclinic017/qf-lib | 198 | 1164 | # Copyright 2016-present CERN – European Organization for Nuclear Research
#
# 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... | 2.4375 | 2 |
watcher/api/controllers/v1/action_plan.py | ajaytikoo/watcher | 64 | 1165 | <reponame>ajaytikoo/watcher
# -*- encoding: utf-8 -*-
# Copyright 2013 Red Hat, 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/licens... | 1.46875 | 1 |
controllers/albums.py | jeonginlee/groove_scheduler | 0 | 1166 | <reponame>jeonginlee/groove_scheduler
from flask import *
albums = Blueprint('albums', __name__, template_folder='templates')
@albums.route('/albums/edit')
def albums_edit_route():
options = {
"edit": True
}
return render_template("albums.html", **options)
@albums.route('/albums')
def albums_route():
options ... | 2.171875 | 2 |
Incident-Response/Tools/dfirtrack/dfirtrack_main/views/division_views.py | sn0b4ll/Incident-Playbook | 1 | 1167 | <filename>Incident-Response/Tools/dfirtrack/dfirtrack_main/views/division_views.py
from django.contrib import messages
from django.contrib.auth.mixins import LoginRequiredMixin
from django.shortcuts import redirect, render
from django.urls import reverse
from django.views.generic import DetailView, ListView
from django... | 1.953125 | 2 |
run.py | shark803/Torch_serve_example_NLP | 1 | 1168 | # coding: UTF-8
import time
import torch
import numpy as np
from train_eval import train, init_network
from importlib import import_module
import argparse
parser = argparse.ArgumentParser(description='Chinese Text Classification')
parser.add_argument('--model', type=str, required=True, help='choose a model: TextCNN')
... | 2.5 | 2 |
src/tests/cfp/views/test_cfp_user.py | xhub/pretalx | 0 | 1169 | <filename>src/tests/cfp/views/test_cfp_user.py
import pytest
from django.conf import settings
from django.core import mail as djmail
from django.core.files.uploadedfile import SimpleUploadedFile
from django.urls import reverse
from django_scopes import scope
from rest_framework.authtoken.models import Token
from preta... | 1.976563 | 2 |
tests/mb_util.py | vasilydenisenko/modbus_rtu_slave | 0 | 1170 | <reponame>vasilydenisenko/modbus_rtu_slave
# MIT License
# Copyright (c) 2021 <NAME>, <NAME>
# 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 lim... | 1.96875 | 2 |
modules/stackoverflow/models.py | tjsavage/polymer-dashboard | 1 | 1171 | <gh_stars>1-10
import fix_path
import json
import datetime
from google.appengine.ext import ndb
# Taken from http://stackoverflow.com/questions/455580/json-datetime-between-python-and-javascript
dthandler = lambda obj: (
obj.isoformat()
if isinstance(obj, datetime.datetime)
or isinstance(obj, datetime.dat... | 2.515625 | 3 |
src/main/java/com/bailei/study/beautyOfCoding/cpu50.py | sonymoon/algorithm | 0 | 1172 | #!/usr/bin/python3
# -*- coding: UTF-8 -*-
import time
busyTime = 10
idleTime = busyTime
while True:
start = time.clock()
while time.clock() - start < busyTime:
pass
time.sleep(busyTime / 1000)
| 3.328125 | 3 |
carto/maps.py | danicarrion/carto-python | 85 | 1173 | """
Module for working with named and anonymous maps
.. module:: carto.maps
:platform: Unix, Windows
:synopsis: Module for working with named and anonymous maps
.. moduleauthor:: <NAME> <<EMAIL>>
.. moduleauthor:: <NAME> <<EMAIL>>
"""
try:
from urllib.parse import urljoin
except ImportError:
from url... | 3.140625 | 3 |
client_driver.py | tlagore/kv_store | 0 | 1174 | from kv_client.kv_client import KVClient
def main():
kvSlave = KVClient(1, "127.0.0.1", 3456)
kvSlave.start()
if __name__ == "__main__":
main() | 1.390625 | 1 |
pytorch-frontend/benchmarks/operator_benchmark/pt/embeddingbag_test.py | AndreasKaratzas/stonne | 206 | 1175 | <reponame>AndreasKaratzas/stonne<filename>pytorch-frontend/benchmarks/operator_benchmark/pt/embeddingbag_test.py
import operator_benchmark as op_bench
import torch
import numpy
from . import configs
"""EmbeddingBag Operator Benchmark"""
class EmbeddingBagBenchmark(op_bench.TorchBenchmarkBase):
def init(self, embe... | 2.1875 | 2 |
python/dgl/geometry/capi.py | lfchener/dgl | 9,516 | 1176 | """Python interfaces to DGL farthest point sampler."""
from dgl._ffi.base import DGLError
import numpy as np
from .._ffi.function import _init_api
from .. import backend as F
from .. import ndarray as nd
def _farthest_point_sampler(data, batch_size, sample_points, dist, start_idx, result):
r"""Farthest Point Samp... | 2.203125 | 2 |
scidb/core/data.py | oxdc/sci.db | 0 | 1177 | import shutil
import hashlib
from pathlib import Path
from typing import TextIO, BinaryIO, IO, Union
from datetime import datetime
from os.path import getmtime
from .low import ObservableDict
class Data:
def __init__(self, data_name: str, parent, bucket,
protected_parent_methods: Union[None, dict... | 2.328125 | 2 |
tensorflow/python/keras/optimizer_v2/optimizer_v2.py | PaulWang1905/tensorflow | 9 | 1178 | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 1.625 | 2 |
escola/teste_get.py | danielrosendos/djangoRestFramework | 2 | 1179 | <filename>escola/teste_get.py
import requests
headers = {
'content-type': 'application/json',
'Authorization': 'Token <PASSWORD>'
}
url_base_cursos = 'http://127.0.0.1:8000/api/v2/cursos'
url_base_avaliacoes = 'http://127.0.0.1:8000/api/v2/avaliacoes'
resultado = requests.get(url=url_base_cursos, headers=hea... | 2.578125 | 3 |
python/avi/sdk/utils/waf_policy/vdi_waf_policy.py | aaronjwood/alb-sdk | 0 | 1180 | <gh_stars>0
# Copyright 2021 VMware, Inc.
import argparse
import json
import re
import logging
import os
import sys
from avi.sdk.avi_api import ApiSession
API_VERSION = "18.2.13"
SYSTEM_WAF_POLICY_VDI='System-WAF-Policy-VDI'
logger = logging.getLogger(__name__)
def add_allowlist_rule(waf_policy_obj):
#add a al... | 2.328125 | 2 |
src/api/bkuser_core/tests/bkiam/test_constants.py | Chace-wang/bk-user | 0 | 1181 | <reponame>Chace-wang/bk-user
# -*- coding: utf-8 -*-
"""
TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-用户管理(Bk-User) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file exce... | 1.710938 | 2 |
votesim/benchmarks/__init__.py | johnh865/election_sim | 8 | 1182 | <filename>votesim/benchmarks/__init__.py
# from votesim.benchmarks.benchrunner import (
# run_benchmark,
# get_benchmarks,
# post_benchmark,
# plot_benchmark,
# )
from votesim.benchmarks import runtools, simple | 1.117188 | 1 |
src/handler.py | MrIgumnov96/ETL-CloudDeployment | 0 | 1183 | import boto3
import src.app as app
import csv
import psycopg2 as ps
import os
from dotenv import load_dotenv
load_dotenv()
dbname = os.environ["db"]
host = os.environ["host"]
port = os.environ["port"]
user = os.environ["user"]
password = os.environ["pass"]
connection = ps.connect(dbname=dbname,
... | 2.4375 | 2 |
improver_tests/precipitation_type/test_utilities.py | cpelley/improver | 77 | 1184 | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# (C) British Crown Copyright 2017-2021 Met Office.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions a... | 1.46875 | 1 |
app/api/v1/models/items.py | bryan-munene/Store-Manager-DB | 0 | 1185 | from .db_conn import ModelSetup
class ItemsModel(ModelSetup):
'''Handles the data logic of the items section'''
def __init__(
self,
name=None,
price=None,
quantity=None,
category_id=None,
reorder_point=None,
auth=None):
... | 3.21875 | 3 |
site/src/sphinx/_extensions/api.py | linxGnu/armeria | 0 | 1186 | <reponame>linxGnu/armeria
from docutils.parsers.rst.roles import register_canonical_role, set_classes
from docutils.parsers.rst import directives
from docutils import nodes
from sphinx.writers.html import HTMLTranslator
from sphinx.errors import ExtensionError
import os
import re
def api_role(role, rawtext, text, li... | 2.171875 | 2 |
feaas/runners/__init__.py | tsuru/varnishapi | 3 | 1187 | # Copyright 2014 varnishapi authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
import time
from feaas import storage
class Base(object):
def __init__(self, manager, interval, *locks):
self.manager = manager
self.st... | 2.359375 | 2 |
ros_buildfarm/debian_repo.py | j-rivero/ros_buildfarm | 0 | 1188 | # Copyright 2014 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | 2.015625 | 2 |
player.py | Drayux/Battlematus | 0 | 1189 | # PLAYER
class player:
def __init__(self):
| 1.695313 | 2 |
Framwork-Backpropagation/utils/utils_v2.py | ConvolutedDog/Implicit-Im2col-for-Backpropagation | 0 | 1190 | # Copyright 2022 ConvolutedDog (https://github.com/ConvolutedDog/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | 2.265625 | 2 |
ark_nlp/factory/utils/attack.py | yubuyuabc/ark-nlp | 1 | 1191 | <gh_stars>1-10
import torch
class FGM(object):
"""
基于FGM算法的攻击机制
Args:
module (:obj:`torch.nn.Module`): 模型
Examples::
>>> # 初始化
>>> fgm = FGM(module)
>>> for batch_input, batch_label in data:
>>> # 正常训练
>>> loss = module(batch_input, batch_labe... | 2.875 | 3 |
core.py | sreejithr/deepfake | 0 | 1192 | import cv2
import torch
import yaml
import imageio
import throttle
import numpy as np
import matplotlib.pyplot as plt
from argparse import ArgumentParser
from skimage.transform import resize
from scipy.spatial import ConvexHull
from modules.generator import OcclusionAwareGenerator
from modules.keypoint_detector import... | 1.726563 | 2 |
soupy/approximations/taylor/backup/__init__.py | cpempire/soupy | 1 | 1193 | <reponame>cpempire/soupy<gh_stars>1-10
from __future__ import absolute_import, division, print_function
from .controlPDEProblem import ControlPDEProblem
from .controlPDEProblemMultiPDE import ControlPDEProblemMultiPDE
from .costFunctionalConstant import CostFunctionalConstant
from .costFunctionalConstantMultiPDE impor... | 1.578125 | 2 |
models/1-Tom/train/kaggle-hubmap-main/src/02_train/transforms.py | navekshasood/HuBMAP---Hacking-the-Kidney | 0 | 1194 | import numpy as np
from albumentations import (Compose, HorizontalFlip, VerticalFlip, Rotate, RandomRotate90,
ShiftScaleRotate, ElasticTransform,
GridDistortion, RandomSizedCrop, RandomCrop, CenterCrop,
RandomBrightnessContrast, HueSatu... | 1.851563 | 2 |
cubspack/geometry.py | Majikat/cubspack | 11 | 1195 | <gh_stars>10-100
# -*- coding: utf-8 -*-
from math import sqrt
class Point(object):
__slots__ = ('x', 'y', 'z')
def __init__(self, x, y, z):
self.x = x
self.y = y
self.z = z
def __eq__(self, other):
return (self.x == other.x and self.y == other.y and self.z == other.z)
... | 3.734375 | 4 |
app/recipe/tests/test_recipe_api.py | tahmadvand/recipe_app_api | 0 | 1196 | <reponame>tahmadvand/recipe_app_api
from django.contrib.auth import get_user_model
from django.test import TestCase
from django.urls import reverse
from rest_framework import status
from rest_framework.test import APIClient
# use that for making our API requests
from core.models import Recipe, Tag, Ingredient
from .... | 2.75 | 3 |
Assignment 1 n 2 Day 8.py | paju3125/LetsUpgrade-Python-B7 | 0 | 1197 | <gh_stars>0
# Assignment 1 Day 8
# write a decorator function for taking input for you
# any kind of function you want to build
def getInput(calculate_arg_fuc):
def wrap_function():
print("Enter two numbers ")
a=int(input("Enter first number = "))
b=int(input("Enter second numbe... | 3.953125 | 4 |
gwcs/coordinate_frames.py | migueldvb/gwcs | 0 | 1198 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Defines coordinate frames and ties them to data axes.
"""
from __future__ import absolute_import, division, unicode_literals, print_function
import numpy as np
from astropy import units as u
from astropy import utils as astutil
from astropy import coo... | 2.828125 | 3 |
modox/chan_modifier.py | lukpazera/modox | 11 | 1199 |
import lx
import modo
import select
import item
from run import run
class ChannelModifierUtils(object):
@classmethod
def attachModifierToItem(cls, modifierModoItem, hostModoItem):
"""
Allows for attaching modifier to locator type item.
Attached item will show up under the locator ... | 2.671875 | 3 |