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 |
|---|---|---|---|---|---|---|
scripts/split_dataset.py | yeshaokai/mmpose_for_maDLC | 5 | 44300 | import json
with open('train.json','r') as f:
gt = json.load(f)
def parse(f):
imgid_2_anno = {}
imgid_2_img = {}
annotations = f['annotations']
images = f['images']
print (len(images))
categories = f['categories']
for img in images:
id = img['id']
imgid_2_i... | 2.71875 | 3 |
insanic/protocol.py | crazytruth/insanic | 4 | 44301 | import time
from sanic.response import HTTPResponse
from sanic.server import HttpProtocol
from insanic.log import access_logger
class InsanicHttpProtocol(HttpProtocol):
def log_response(self, response: HTTPResponse) -> None:
"""
Logs the response. More expressive than Sanic's implmenetation.
... | 2.515625 | 3 |
recruiting/migrations/0002_adminresume_bottom_msg.py | NSYT0607/DONGKEY | 1 | 44302 | <filename>recruiting/migrations/0002_adminresume_bottom_msg.py<gh_stars>1-10
# Generated by Django 2.0.1 on 2018-02-15 22:20
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('recruiting', '0001_initial'),
]
operations = [
migrations.AddFi... | 1.46875 | 1 |
django_robokassa/app.py | AlekseyA/django-robokassa | 0 | 44303 | <gh_stars>0
from django.apps import AppConfig
class RobokassaConfig(AppConfig):
name = 'django-robokassa'
label = 'Robokassa'
verbose_name = u'Робокасса'
| 1.125 | 1 |
exchangelib/services/expand_dl.py | mishmashclone/ecederstrand-exchangelib | 0 | 44304 | from .common import EWSService
from ..errors import ErrorNameResolutionMultipleResults
from ..properties import Mailbox
from ..util import create_element, set_xml_value, MNS
class ExpandDL(EWSService):
"""MSDN: https://docs.microsoft.com/en-us/exchange/client-developer/web-service-reference/expanddl-operation"""
... | 1.929688 | 2 |
data/scripts/summarize_buidlings.py | chihacknight/state-by-state-decarbonization | 2 | 44305 | # %%
import pandas as pd
# %%
# path to data, see
# res stock meta: https://data.openei.org/s3_viewer?bucket=oedi-data-lake&prefix=nrel-pds-building-stock%2Fend-use-load-profiles-for-us-building-stock%2F2021%2Fresstock_amy2018_release_1%2Ftimeseries_aggregates_metadata%2F
# com stock meta: https://data.openei.org/s3_vi... | 2.3125 | 2 |
build/lib/MCMTpy/utils/MomentTensor.py | OUCyf/MCMTpy | 22 | 44306 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun May 23 19:53:22 2021
@author: <NAME> (<EMAIL>) at USTC
This script refers to some theories and codes of Obspy/MoPaD/Introduction to Seismology (Yongge Wan):
1) The MoPaD program (https://github.com/geophysics/MoPaD);
2) str_dip_rake to mt;
3... | 3.265625 | 3 |
src/djlime/forms/widgets.py | freshlimestudio/djlime | 0 | 44307 | """
djlime.forms.widgets
~~~~~~~~~~~~~~
Extended django form widgets.
:copyright: (c) 2012 by <NAME>.
:license: BSD, see LICENSE for more details.
"""
from itertools import chain
from django.forms import widgets
from django.forms.util import flatatt
from django.utils.encoding import force_unicode... | 1.992188 | 2 |
nntoolbox/sequence/models/encoder.py | nhatsmrt/nn-toolbox | 16 | 44308 | import torch
from torch import nn, Tensor
from typing import Tuple
from ..components import ResidualRNN
__all__ = ['Encoder', 'RNNEncoder', 'GRUEncoder']
class Encoder(nn.Module):
def __init__(self, input_size, hidden_size, embedding_dim, num_layers, bidirectional, device, pad_token=0, drop_rate=0.1):
s... | 2.5625 | 3 |
PR_BCI_team/Team_StarLab/DKHan/examples/eeg_dg/train_eval.py | PatternRecognition/OpenBMI | 217 | 44309 | import torch
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
class LabelSmoothingCrossEntropy(torch.nn.Module):
def __init__(self):
super(LabelSmoothingCrossEntropy, self).__init__()
def forward(self, x, target, smoothing=0.1):
confidence = 1. - smoothing... | 2.765625 | 3 |
sdk/core/azure-common/azure/common/cloud.py | vincenttran-msft/azure-sdk-for-python | 1 | 44310 | <gh_stars>1-10
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#------------------------------------------------------------------------... | 2.0625 | 2 |
udiYoDoorSensor.py | Panda88CO/udi-yolink | 0 | 44311 | <reponame>Panda88CO/udi-yolink
#!/usr/bin/env python3
"""
Polyglot TEST v3 node server
MIT License
"""
from os import truncate
import sys
import time
from yolinkDoorSensorV2 import YoLinkDoorSens
try:
import udi_interface
logging = udi_interface.LOGGER
Custom = udi_interface.Custom
except ImportError:
... | 1.617188 | 2 |
utils/vis_tool.py | elbert-xiao/RFCN-Pytorch | 11 | 44312 | import matplotlib
import numpy as np
import time
# matplotlib.use('Agg')
import matplotlib.pyplot as plt
VOC_BBOX_LABEL_NAMES = (
'fly',
'bike',
'bird',
'boat',
'pin',
'bus',
'c',
'cat',
'chair',
'cow',
'table',
'dog',
'horse',
'moto',
'p',
'plant',
... | 2.953125 | 3 |
vega/app.py | YEZHIAN1996/pythonstudy | 1 | 44313 | <reponame>YEZHIAN1996/pythonstudy
from colorama import Fore, Style
from getpass import getpass
from service.user_service import UserService
from service.news_service import NewsService
import mysql
import os
import sys
import time
__user_service = UserService()
__news_service = NewsService()
while 1:
os.system('cl... | 2.578125 | 3 |
deprecated/rcbu/common/activity_mixin.py | nloadholtes/python-cloudbackup-sdk | 4 | 44314 | <gh_stars>1-10
import rcbu.common.status as status
import rcbu.common.activity as activity
from rcbu.common.http import Http
_predicates = {
"backup_history": lambda j: j['Type'] == 'Backup' and not _is_running(j),
"restore_history": lambda j: j['Type'] == 'Restore' and not _is_running(j),
"cleanup_histor... | 2.15625 | 2 |
xbox/webapi/api/provider/titlehub/models.py | OpenXbox/xbox-webapi-python | 122 | 44315 | <reponame>OpenXbox/xbox-webapi-python
from datetime import datetime
from enum import Enum
from typing import Any, List, Optional
from xbox.webapi.common.models import CamelCaseModel, PascalCaseModel
class TitleFields(str, Enum):
SERVICE_CONFIG_ID = "scid"
ACHIEVEMENT = "achievement"
STATS = "stats"
G... | 2.34375 | 2 |
other/_first.py | ngd-b/python-demo | 1 | 44316 | <gh_stars>1-10
#!/usr/bin/python
# -*- coding:utf-8 -*-
print("hello world")
# pthon 中的关键字
import keyword
print(keyword.kwlist)
# 注释
'''
一行注释
二行注释
'''
"""
三行注释
四行注释
"""
print("多行注释")
# 单行语句换行
print("you"
"are"
"my"
"friend")
# 这种运算则需要使用 \ 符
count = 23+ \
12+ \
34
print(count)
# 字符串 复用
print("祖... | 3.390625 | 3 |
main.py | Sohone-Guo/Pointer-Generator | 56 | 44317 |
from lib.util.processing import processing
from lib.model.encoder import SimpleEncoder
from lib.model.decoder import AttentionDecoder
import torch
import random
if __name__ == "__main__":
# 1. Declare the hyperparameter
device, configure, word_index, index_word, train_loader, test_loader = processing... | 2.421875 | 2 |
output/misc_func.py | jacobseiler/rsage | 1 | 44318 | <gh_stars>1-10
#!/usr/bin/env python
from __future__ import print_function
import os
import matplotlib
matplotlib.use('Agg')
import pylab as plt
import numpy as np
from numpy.fft import fftn, ifftn
import scipy.integrate as integrate
from scipy import stats
import PlotScripts
import ReadScripts
import AllVars
def... | 2.671875 | 3 |
brl_gym/envs/mujoco/test_pusher_policy.py | gilwoolee/brl_gym | 2 | 44319 | import julia
import numpy as np
import os.path as osp
import gym
from brl_gym.envs.mujoco import box_pusher
env = box_pusher.BoxPusher()
rlopt = "/home/gilwoo/School_Workspace/rlopt"
j = julia.Julia()
j.include(osp.join(rlopt, "_init.jl"))
j.include(osp.join(rlopt, "src/pg/Baseline.jl"))
j.include(osp.join(rlopt, "sr... | 2.34375 | 2 |
GalleryMan/assets/__init__.py | 0xsapphir3/GalleryMan | 9 | 44320 | <gh_stars>1-10
# Nothing To See Here ._. | 1.007813 | 1 |
contentcuration/contentcuration/utils/cache.py | kollivier/studio | 1 | 44321 | <filename>contentcuration/contentcuration/utils/cache.py
import functools
import math
import random
import time
from django.core.cache import cache
DEFERRED_FLAG = "__DEFERRED"
def cache_stampede(expire, beta=1):
"""Cache decorator with cache stampede protection.
Based on http://www.vldb.org/pvldb/vol8/p88... | 2.484375 | 2 |
S8/objetos.py | Escannor/Algoritmia_21-2 | 1 | 44322 | ## class <nombre_del_objeto>:
## def <metodo_del_objeto>(self):
# variable -> atributos
# funciones -> metodos
def hola():
print("hola a todos")
hola()
class Persona:
def __init__(self, nombre):
self.nombre = nombre
def hola(self):
print("Hola a todos, soy", self.nombre)
de... | 3.8125 | 4 |
dynamics/util/gaussianize.py | bodokaiser/complex-systems | 2 | 44323 | import numpy as np
from scipy.optimize import fmin
from scipy.stats import kurtosis
from scipy.special import lambertw
"""
The algorithm is based on [1]. The implementation is based on [2].
[1]: <NAME>, 2013 (https://arxiv.org/pdf/1010.2265.pdf)
[2]: <NAME>, 2015 (https://github.com/gregversteeg/gaussianize)
"""
d... | 2.765625 | 3 |
backend/portfolios/factories/certification_factory.py | NumanIbnMazid/numanibnmazid.com | 1 | 44324 | import factory
from portfolios.models import Certification
from users.factories.user_factory import UserFactory
from factory.django import DjangoModelFactory
from utils.helpers import create_factory_data
class CertificationFactory(DjangoModelFactory):
class Meta:
model = Certification
user = factory.... | 2.421875 | 2 |
examples/py/factorization/parse_netflix.py | pnijhara/h2o4gpu | 458 | 44325 | <reponame>pnijhara/h2o4gpu<gh_stars>100-1000
import numpy as np
import scipy
from sklearn.model_selection import train_test_split
files = [
'../data/combined_data_1.txt',
'../data/combined_data_2.txt',
'../data/combined_data_3.txt',
'../data/combined_data_4.txt',
]
if __name__ == '__main__':
coo_r... | 2.625 | 3 |
src/esri/arcpy/SamplePythonToolbox.py | TrieuLe0801/Arcgis-python | 0 | 44326 | <filename>src/esri/arcpy/SamplePythonToolbox.py
# -*- coding: utf-8 -*-
import arcpy
import os
import foo
class Toolbox(object):
def __init__(self):
"""Define the toolbox (the name of the toolbox is the name of the
.pyt file)."""
self.label = "Sample Python Toolbox"
self... | 2.703125 | 3 |
python/user/bot/__init__.py | star123good/DAML-Chat-Projectdabl | 1 | 44327 | <reponame>star123good/DAML-Chat-Projectdabl<filename>python/user/bot/__init__.py<gh_stars>1-10
from .user_bot import main
main()
| 0.980469 | 1 |
utility/error.py | ghowland/dirdb | 1 | 44328 | <gh_stars>1-10
"""
Error Reporting
"""
import sys
def Error(text, options, exit_code=1):
"""Fail with an error. Options are required to deliver proper output."""
#output = {'error': text, 'exit_code':exit_code}
#
## Format errors and output them, in the specified fashion
#format.FormatAndOuput(output, opt... | 2.828125 | 3 |
python/flask/3_post_request/app.py | apt-info/samples | 6 | 44329 | <reponame>apt-info/samples<gh_stars>1-10
# _*_ coding: utf-8 _*_
from flask import Flask, request
import json
import requests
app = Flask(__name__)
@app.route('/')
def root():
return 'welcome to flask'
@app.route('/handle_post', methods=['POST'])
def handle_post():
params = json.loads(request.get_data(), e... | 2.484375 | 2 |
labellab-flask/api/routes/images.py | AkMo3/LabelLab | 0 | 44330 | from flask import Blueprint
from api.controllers import imagescontroller
imagesprint = Blueprint("images", __name__)
imagesprint.add_url_rule(
"/image/create/<int:project_id>",
view_func=imagescontroller.imageController["save_image"],
methods=["POST"]
)
imagesprint.add_url_rule(
"/image/get/<int:p... | 2.5 | 2 |
PyLaGriT/setup.py | millerta/LaGriT-1 | 1 | 44331 | from distutils.core import setup
import os
setup(name='pylagrit',
version='1.0.0',
description='Python interface for LaGriT',
author='<NAME>',
author_email='<EMAIL>',
url='lagrit.lanl.gov',
license='LGPL',
packages=[
'pylagrit',
'pylagrit.pexpect']
)
| 1.046875 | 1 |
vkbottle/api/token_generator/__init__.py | homus32/vkbottle | 698 | 44332 | from .abc import ABCTokenGenerator, Token
from .consistent import ConsistentTokenGenerator
from .single import SingleTokenGenerator
from .util import get_token_generator
| 1.257813 | 1 |
scripts/bib_poli_poi_manager.py | sdcioc/bibpoli | 0 | 44333 | #! /usr/bin/python
# Author: <NAME> 19/09/2018
import json
import copy
import rospy
#functie de converire a numelui unui punct de interes in calea lui ca parametru ros
def convert_POIName_RosparamName(poi_name):
prefix = '/mmap/poi/submap_0/';
if not poi_name.startswith(prefix):
poi_name = prefix + poi_name;
r... | 2.71875 | 3 |
src/HAnDS/sampled_dataset_intersection.py | abhipec/hands | 13 | 44334 | """
Compute intersection of two sampled datasets sentences.
"""
import sys
import glob
import json
import gzip
def get_uids(input_file_path):
"""
Convert datasets to set of uids.
"""
use_gzip = True if input_file_path[-3:] == '.gz' else False
if use_gzip:
file_i = gzip.GzipFile(input_file... | 3.1875 | 3 |
cloud_function/main.py | LeptoFlare/unnamed-color-bot | 0 | 44335 | from flask import jsonify
from discord_interactions import verify_key, InteractionType, InteractionResponseType
import color
PUBLIC_KEY = ""
def handler(request):
# Verify request
signature = request.headers.get("X-Signature-Ed25519")
timestamp = request.headers.get("X-Signature-Timestamp")
if (
... | 2.84375 | 3 |
tests/test_feature_selection.py | NewKnowledge/punk | 2 | 44336 | import unittest
import numpy as np
import pandas as pd
from sklearn import datasets
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
from punk.feature_selection import PCAFeatures
from punk.feature_selection import RFFeatures
class TestPCA(unittest.TestCase):... | 2.875 | 3 |
src/project/video_labels.py | KumarLabJax/JABS-behavior-classifier | 0 | 44337 | from .track_labels import TrackLabels
class VideoLabels:
"""
store the labels associated with a video file.
labels are organized by "identity". Each identity may have multiple
behaviors labeled. An identity and behavior uniquely identifies a
TrackLabels object, which stores labels for each frame ... | 3.59375 | 4 |
.ycm_extra_conf.py | puremourning/vim | 0 | 44338 | <filename>.ycm_extra_conf.py
import os
import logging
import subprocess
import shlex
from ycmd import utils
try:
from ycmd.extra_conf_support import IgnoreExtraConf
except ImportError:
IgnoreExtraConf = None
# Map files to translation units.
file_to_tu = {
'nbdebug.c': 'netbeans.c',
'if_py_both.h': 'if_python... | 2.03125 | 2 |
atpparser/parser.py | nathanesau/atpparser | 0 | 44339 | from bs4 import BeautifulSoup
from urllib.request import urlopen, Request
import math
from atpparser.constants import HEADERS
from atpparser.util import format_player_name, get_archive_url, get_archive_filename, \
get_draw_url, get_draw_filename
# downloads archive to "archive_{year}.html"
def downloadArchive(year... | 3 | 3 |
PersonalWebApp/ClientsManagement/migrations/0018_projectsrequest_project_request_slug.py | CiganOliviu/personal_website | 1 | 44340 | <filename>PersonalWebApp/ClientsManagement/migrations/0018_projectsrequest_project_request_slug.py
# Generated by Django 3.0.8 on 2020-11-09 10:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ClientsManagement', '0017_auto_20201108_1950'),
]
... | 1.609375 | 2 |
model/cct/__init__.py | gmberton/deep-visual-geo-localization-benchmark | 1 | 44341 | from .cct import cct_14_7x2_384, cct_14_7x2_224 | 0.953125 | 1 |
ex01/first_last.py | aiit2016/2016-2Q-SP | 0 | 44342 | <gh_stars>0
def first_last(s1):
# [out of bound error] s2 = s1[0] + s1[1] + s1[4] + s1[5]
# [out of bound error] s2 = s1[0] + s1[1] + s1[-2] + s1[-1]
# [false result] s2 = s1[0:2] + s1[-2:-1]
s2 = s1[0:2] + s1[-2:]
# [out of bound error] s2 = s1[:2] + s1[-2]
return s2
print(first_last("... | 3.421875 | 3 |
setup.py | fengsp/lookup | 9 | 44343 | <gh_stars>1-10
"""
lookup
------
Look up words via the command line.
Links
`````
* `documentation <https://github.com/fengsp/lookup>`_
* `development version
<http://github.com/fengsp/lookup/zipball/master#egg=lookup-dev>`_
"""
from setuptools import setup
setup(
name='lookup',
version='0.2',
url='h... | 1.453125 | 1 |
besspin/cyberPhys/cyberphyslib/cyberphyslib/demonstrator/simulator.py | CTSRD-CHERI/BESSPIN-Tool-Suite | 0 | 44344 | """
Project: SSITH CyberPhysical Demonstrator
Name: simulator.py
Author: <NAME>, <NAME> <<EMAIL>>
Date: 10/01/2020
Python 3.8.3
O/S: Windows 10
This routine creates a BeamNG simulator thread and makes vehicle speed,
throttle, brakes, and position available.
"""
import logging.config
import logging
import enum
import... | 2.421875 | 2 |
sdk/python/pulumi_aws_native/codestar/_inputs.py | AaronFriel/pulumi-aws-native | 29 | 44345 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
__a... | 1.984375 | 2 |
f5/bigip/__init__.py | yuanfm/f5-common-python | 0 | 44346 | """Classes and functions for configuring BIG-IP"""
# Copyright 2014 F5 Networks 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
#
# Unle... | 2.390625 | 2 |
tests/test_evolution.py | jakelishman/floq | 2 | 44347 | from unittest import TestCase
from tests.assertions import CustomAssertions
import scipy.sparse
import numpy as np
import tests.rabi as rabi
import floq
class TestSetBlock(TestCase):
def setUp(self):
self.dim_block = 5
self.n_block = 3
self.a, self.b, self.c, self.d, self.e, self.f, self.g... | 2.40625 | 2 |
Practicals/gist_multiplication_table-tutorial.py | dev-bhargav/Python3-for-dummies | 0 | 44348 | import random as RND
gen_row = lambda: [ RND.randint(10, 99) for c in range(3) ]
# 'data' is a nested list comprised of five rows and three columns
data = [gen_row() for c in range(5)]
# create some column headers
col_headers = ["col{}".format(i) for i in range(1, 4)]
# print the column headers first
print("{:^8} {:^... | 3.9375 | 4 |
agent/agent/lib/agent_thread/threadmgr.py | isabella232/cronus-agent | 7 | 44349 | <reponame>isabella232/cronus-agent<filename>agent/agent/lib/agent_thread/threadmgr.py<gh_stars>1-10
#pylint: disable=R0904,W0105
'''
Copyright 2014 eBay Software Foundation
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 ... | 2.171875 | 2 |
Math/C01_Geometry_basics/Programs/S05/Point_dilation_image.py | Polirecyliente/SGConocimiento | 0 | 44350 | <reponame>Polirecyliente/SGConocimiento
#T# the following code shows how to draw a point dilation
#T# to draw a point dilation, the pyplot module of the matplotlib package is used
import matplotlib.pyplot as plt
#T# create the figure and axes
fig1, ax1 = plt.subplots(1, 1)
#T# set the aspect of the axes
ax1.set_aspe... | 3.734375 | 4 |
ven2/lib/python2.7/site-packages/zope/browserresource/tests/test_directory.py | manliu1225/Facebook_crawler | 1 | 44351 | <gh_stars>1-10
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this dis... | 1.554688 | 2 |
tools/register_stats.py | kunheek/style-aware-discriminator | 21 | 44352 | <gh_stars>10-100
#!/usr/bin/env python
import argparse
import glob
import os
import shutil
import cleanfid
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("stats_dir")
args = parser.parse_args()
assert os.path.isdir(args.stats_dir)
return args
def main():
args = par... | 2.640625 | 3 |
diff_between_dates.py | DazEB2/SimplePyScripts | 117 | 44353 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
from datetime import datetime
items = [
'23/03/2007',
'05/12/2007',
'22/08/2008',
'02/10/2009',
]
for i in range(len(items) - 1):
date_str_1, date_str_2 = items[i], items[i + 1]
date_1 = datetime.strptime(date_str_1, '... | 3.65625 | 4 |
cogs/fun.py | Skullknight011/Cyanmaton | 1 | 44354 | import discord
from discord.ext import commands
import os
import numpy
import requests
import json
import random
import json
import sys
import traceback
import importlib
from math import *
from cogs.lists import cowboy_sayings
from cogs.lists import roasts
from cogs.lists import colour
from cogs.lists import lenny_face... | 2.546875 | 3 |
gazenet/models/shared_components/gmu/model.py | modular-ml/gasp-gated-attention-for-saliency-prediction | 1 | 44355 | <reponame>modular-ml/gasp-gated-attention-for-saliency-prediction<filename>gazenet/models/shared_components/gmu/model.py
# -*- coding: utf-8 -*-
"""This module implements the Gated Multimodal Units in PyTorch
Currently there are two versions:
Two versions, the general GMU and the simplified, bimodal unit
are described... | 2.578125 | 3 |
HighJack 4/master.py | fullmetalstug/sdstate-cubesat | 1 | 44356 | from smbus import SMBus
import time
import csv
import serial
#import thread
LIS3DH = False
MPL3115A2 = False
GPS = False
deg = u'\N{DEGREE SIGN}'
apo = u"\u0027" #apostrophe
serialport = serial.Serial(
port="/dev/ttyACM0",
baudrate=9600,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
by... | 2.59375 | 3 |
sirepo/template/madx.py | moellep/sirepo | 0 | 44357 | # -*- coding: utf-8 -*-
u"""MAD-X execution template.
:copyright: Copyright (c) 2020 RadiaSoft LLC. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
from pykern import pkio
from pykern import pkjinja
from pykern.pkcolle... | 1.820313 | 2 |
keras/lstm_my.py | mobarski/sandbox | 0 | 44358 | text = """
ala ma kota
a kot ma ale
"""
# ------------------------------------------------------------------------------
# TODO as class
chars = list(sorted(set(text))) # stabilne indeksy
len_chars = len(chars)+1
c_to_i = {c:i+1 for i,c in enumerate(chars)}
i_to_c = {i+1:c for i,c in enumerate(chars)}
def text_to_i... | 3.265625 | 3 |
xplainer/backend/tools/lime.py | liborvaneksw/xplainer | 4 | 44359 | import tensorflow as tf
from lime import lime_image
from skimage.segmentation import mark_boundaries
from xplainer.backend.tools.abstract_tool import AbstractTool, GeneralSettings
from xplainer.backend.utils.image import prepare_for_prediction, get_base64png
class Lime(AbstractTool):
def name(self):
retu... | 2.046875 | 2 |
test/ee2_scheduler_integration_test.py | scanon/execution_engine2 | 0 | 44360 | <filename>test/ee2_scheduler_integration_test.py<gh_stars>0
# -*- coding: utf-8 -*-
import logging
import os
import pwd
import unittest
import htcondor
logging.basicConfig(level=logging.INFO)
from lib.execution_engine2.utils.Condor import Condor
class ExecutionEngine2SchedulerIntegrationTest(unittest.TestCase):
... | 2.171875 | 2 |
DatabaseLayer/DataModel.py | BenTeo11/python-docs-hello-world | 0 | 44361 | <reponame>BenTeo11/python-docs-hello-world<filename>DatabaseLayer/DataModel.py
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import desc
from sqlalchemy_utils import UUIDType
from uuid import uuid4
import json
from DatabaseLayer.Settings import app
#from DatabaseLayer.UserModel import ... | 2.765625 | 3 |
oth-chain/utils/node.py | McSido/oth-chain | 0 | 44362 | from typing import List, Optional
class Node(object):
""" A tree node class for the DDos prevention chain.
Each node has a content of type string,
a parent of type Node (None if root node)
and a list of children (type: List[Node])
Args:
content: The content of the node
... | 3.859375 | 4 |
Define_Model/model.py | Wenhao-Yang/DeepSpeaker-pytorch | 8 | 44363 | #!/usr/bin/env python
# encoding: utf-8
"""
@Author: yangwenhao
@Contact: <EMAIL>
@Software: PyCharm
@File: model.py
@Overview: The deep speaker model is not entirely the same as ResNet, as there are convolutional layers between blocks.
"""
import math
import torch
import torch.nn as nn
from torch.autograd import Fu... | 2.828125 | 3 |
chevah/compat/tests/manual/__init__.py | chevah/compat | 5 | 44364 | """
Manual tests.
"""
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
| 1.078125 | 1 |
util/scraper/core.py | IRIS-Team/tchecker | 17 | 44365 | <filename>util/scraper/core.py
from util.core import *
from util.duckduckgo import *
from util.emails import *
def verifyScraper():
results = DuckDuckGo.search(f'intext:"Verifying myself: I am" site:twitter.com verified')
if len(results) == 0:
raise Exception('No results found')
for result in res... | 3.125 | 3 |
doc/examples/python_logging.py | ralphm/udplog | 0 | 44366 | <gh_stars>0
"""
Example of using the standard logging facility to send events to udplog.
"""
import logging
import socket
import warnings
from udplog.udplog import UDPLogger, UDPLogHandler
# Get a logger in the idiomatic way.
logger = logging.getLogger(__name__)
# Set up logging to stdout
logging.basicConfig(level=... | 3.140625 | 3 |
app/foursquare.py | ExesiosPB/libm | 0 | 44367 | import requests
from datetime import datetime
CLIENT_ID = '2OWPT1X5RNXEE0DGOM5VWO2FBM5R5TNTVPPLH50NCSZAX3QD'
CLIENT_SECRET = '<KEY>'
DATE = datetime.today().strftime('%Y%m%d')
BASE_URL = 'https://api.foursquare.com/v2'
AUTH_URL_PART = 'client_id={}&client_secret={}&v={}'.format(CLIENT_ID, CLIENT_SECRET, DATE)
# Four... | 3.046875 | 3 |
tests/test_gf.py | senk8/crypto-math | 1 | 44368 | <filename>tests/test_gf.py
from crypto_math import GF, field_extension
import pytest
@pytest.fixture
def setup():
F7 = GF(7)
F7_4 = field_extension(F7, 4)
return F7_4
@pytest.mark.parametrize(
"x,y,expect",
[
([1, 1, 1, 1], [2, 3, 1], [1, 3, 4, 2]),
([2, 3, 1], [6, 1, 3, 1], [6, ... | 2.421875 | 2 |
fgietAdmission/settings/prod.py | rpsingh21/Fgiet-Admission | 5 | 44369 | <filename>fgietAdmission/settings/prod.py
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(
os.path.dirname(os.path.abspath(__file__))))
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = os.environ.get(
'... | 1.71875 | 2 |
user_profile/urls.py | DeWaster/Tviserrys | 0 | 44370 | from django.conf.urls import include, url
from django.contrib import admin
from . import views
urlpatterns = [
url(r'^$', views.ViewView.as_view(), name='profile_own_view'),
url(r'^edit/', views.EditView.as_view(), name='profile_edit'),
url(r'^view/$', views.ViewView.as_view(), name='profile_own_view'),
... | 1.859375 | 2 |
simulators/plots/plot_functions.py | Arseni1919/dcop_simulator_3 | 0 | 44371 | <gh_stars>0
import matplotlib.pyplot as plt
from simulators.functions import *
lines = ['-', '--', '-.', ':', ]
lines.reverse()
markers = ['o', '+', '.', ',', '_', '*']
markers.reverse()
def plot_position_choices(all_agents, collisions):
"""
Here we can see collisions inside a graph
:param all_agents: [... | 3.25 | 3 |
fig3-4_controlled_oscillation/fig3d-f_HF_enumeration/4edges/dyn_2020_4_HE_G2_v2.py | sjx93/rnn_for_gene_network_2020 | 5 | 44372 | <filename>fig3-4_controlled_oscillation/fig3d-f_HF_enumeration/4edges/dyn_2020_4_HE_G2_v2.py
import argparse
import sys
import csv
import os
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
FLAGS = None
BATCH = 8000
Gs = 2 # num of dynamic dims
Gin= 2 # num of input signal dims
TIMESTEP = 0.... | 1.960938 | 2 |
src/GameManager/character.py | maccam912/Oddyssey | 0 | 44373 | <reponame>maccam912/Oddyssey<gh_stars>0
import pygame
from GameManager.algorithm.path_finding import a_star_algorithm
from GameManager.algorithm.visibility import raycasting_sight, bresenhams_line_algorithm
class Character():
def __init__(self, x, y, char, foreground, background, graph, name, sight, health, is_blo... | 2.765625 | 3 |
simulator/bus_api.py | btelle/bus-gps | 1 | 44374 | import os
import sys
import json
import logging
import requests
class ApiException(Exception):
""" API Exception class. """
pass
logger = logging.getLogger()
logger.setLevel(logging.INFO)
try:
api_url = os.environ['BUS_API_URL']
if api_url[-1] == '/':
api_url = api_url[0:-1]
except KeyError... | 3.015625 | 3 |
ex006.py | danieldf0l/exercicios-curso-python3 | 0 | 44375 | <reponame>danieldf0l/exercicios-curso-python3<gh_stars>0
n = float(input('Insira um número: '))
print(f"""O dobro de {n:.0f} é: {n*2:.0f} \nO triplo de {n:.0f} é {n*3:.0f}
a raiz quadrada de {n:.0f} é {pow(n,(1/2)):.2}""")
| 3.953125 | 4 |
waterflow/utility/fluxfunctions.py | bramappelt/flow | 0 | 44376 | <reponame>bramappelt/flow<filename>waterflow/utility/fluxfunctions.py<gh_stars>0
""" Several flow equations for (un)saturated flow problems and a
storage change function """
def darcy(x, s, gradient, kfun=lambda x, s: 1):
""" Flux function for saturated flow
Flow equation as first described by :cite:`Darcy18... | 3.109375 | 3 |
ov2640_config.py | FunPythonEC/OV2640_uPy | 6 | 44377 | <reponame>FunPythonEC/OV2640_uPy
#light mode
SUNNY=[
[0xff, b'\x00'],
[0xc7, b'\x40'],
[0xcc, b'\x5e'],
[0xcd, b'\x41'],
[0xce, b'\x54']
]
CLOUDY=[
[0xff, b'\x00'],
[0xc7, b'\x40'],
[0xcc, b'\x65'],
[0xcd, b'\x41'],
[0xce, b'\x4f']
]
OFFICE=[
[0xff, b'\x00'],
[0xc7, b'\x40'],
[0xcc, b'\x52'],
[0xcd, b'\x41'],
[0xce, ... | 1.59375 | 2 |
classification/linear_svm_classification.py | VinAIResearch/PointSWD | 4 | 44378 | import os
import os.path as osp
import sys
import numpy as np
from sklearn.svm import LinearSVC
from tqdm import tqdm
sys.path.append(osp.dirname(osp.dirname(osp.abspath(__file__))))
import torch.utils.data as data
from dataset.modelnet40 import LatentCapsulesModelNet40, LatentVectorsModelNet40
from utils.utils impo... | 2.171875 | 2 |
datemike/base.py | angstwad/datemike | 8 | 44379 | <filename>datemike/base.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of datemike: https://github.com/angstwad/datemike
#
# Copyright 2014 <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 obtai... | 2.40625 | 2 |
test/_data/generator/dps_pds/gp_practices.py | NHSDigital/list-reconciliation | 4 | 44380 | ref = [
"A00002",
"A00005",
"A10001",
"A10002",
"A10003",
"A10004",
"A10005",
"A10006",
"A10007",
"A10008",
"A10009",
"A10010",
"A10011",
"A10012",
"A10013",
"A10014",
"A10015",
"A10016",
"A10017",
"A10018",
"A10019",
"A10020",
... | 1.203125 | 1 |
virtual/lib/python3.6/site-packages/lazr/restfulclient/errors.py | marknesh/pitches | 0 | 44381 | <reponame>marknesh/pitches
# Copyright 2008 Canonical Ltd.
# This file is part of lazr.restfulclient.
#
# lazr.restfulclient is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of the
# Li... | 1.890625 | 2 |
pylib/anarelmanage/automation.py | slaclab/anarel-manage | 3 | 44382 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import sys
import datetime
import time
from collections import defaultdict
import anarelmanage.util as util
import yaml
#import paramiko as pm
import getpass
import shutil
import smtplib
from email.mi... | 1.734375 | 2 |
libretto/migrations/0010_removes_useless_db_index.py | adrienlachaize/dezede | 15 | 44383 | from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('libretto', '0009_auto_20150423_2042'),
]
operations = [
migrations.AlterModelOptions(
name='pupitre',
options={'ordering': ('-soliste', 'partie'), 'verbose_name': 'p... | 1.695313 | 2 |
venv/lib/python3.6/site-packages/pelican/tests/test_rstdirectives.py | Patrisha-de-Boon/CMPUT404-Lab5 | 0 | 44384 | from unittest.mock import Mock
from pelican.tests.support import unittest
class Test_abbr_role(unittest.TestCase):
def call_it(self, text):
from pelican.rstdirectives import abbr_role
rawtext = text
lineno = 42
inliner = Mock(name='inliner')
nodes, system_messages = abbr_r... | 2.734375 | 3 |
tmapi/models/name.py | ajenhl/django-tmapi | 2 | 44385 | # Copyright 2011 <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/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | 1.882813 | 2 |
src/tests/echo/perfengine.py | davidgcameron/arc | 0 | 44386 | #!/usr/bin/env python
from __future__ import print_function
from platform import node
from sys import argv
from os import popen
from re import *
def matlabRange(threads):
limits = threads.split(":")
if len(limits)==1:
return range(int(limits[0]),int(limits[0])+1)
if len(limits)==2:
return... | 2.90625 | 3 |
PyObjCTest/test_nsdocktile.py | Khan/pyobjc-framework-Cocoa | 132 | 44387 | <reponame>Khan/pyobjc-framework-Cocoa
from AppKit import *
from PyObjCTools.TestSupport import *
class TestNSDockTile (TestCase):
def testMethods(self):
self.assertResultIsBOOL(NSDockTile.showsApplicationBadge)
self.assertArgIsBOOL(NSDockTile.setShowsApplicationBadge_, 0)
def testConstants(sel... | 1.851563 | 2 |
src/tests/ftest/pool/uuid_corner_case.py | fedepad/daos | 429 | 44388 | #!/usr/bin/python3
"""
(C) Copyright 2018-2021 Intel Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent
"""
from apricot import TestWithServers
class UUIDCornerCase(TestWithServers):
"""Create and destroy a pool with UUID.
This test covers some corner case and regression regarding UUID usage in
... | 2.375 | 2 |
chalicelib/util/toml.py | la-mar/ecs-cluster-management | 3 | 44389 | import os
from typing import Dict, Optional
import tomlkit
def _get_project_meta(pyproj_path: str = "./pyproject.toml") -> Dict[str, str]:
if os.path.exists(pyproj_path):
with open(pyproj_path, "r") as pyproject:
file_contents = pyproject.read()
return tomlkit.parse(file_contents)["to... | 2.46875 | 2 |
lesson9/napalm_simple.py | mfeindt0705/pynetmf | 0 | 44390 | <reponame>mfeindt0705/pynetmf<gh_stars>0
#!/usr/bin/env python
from getpass import getpass
from pprint import pprint
from napalm import get_network_driver
# Supress SSL Certificate Warnings
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnin... | 2.4375 | 2 |
feed_parser.py | Mason-Lin/real-time-feed | 0 | 44391 | import datetime as dt
import logging
from collections import Counter, OrderedDict, defaultdict
from dataclasses import dataclass
from io import StringIO
from operator import itemgetter
input = """8
2017-01-03,16:18:50,AAPL,142.64
2017-01-03,16:25:22,AMD,13.86
2017-01-03,16:25:25,AAPL,141.64
2017-01-03,16:25:28,AMZN,84... | 3 | 3 |
avroc/files.py | spenczar/avroc | 5 | 44392 | <reponame>spenczar/avroc<filename>avroc/files.py
from typing import Dict, IO, Any, Optional, Iterable
import secrets
import json
import io
from avroc.codegen.read import ReaderCompiler
from avroc.codegen.write import WriterCompiler
from avroc.codegen.resolution import ResolvedReaderCompiler
from avroc.util import Sche... | 2.25 | 2 |
run_scraper.py | justinslud/scrape-wikipedia-current-events | 0 | 44393 | from wiki_scrape_db import get_headlines
headlines = []
for year in list(range(1995, 2020)):
try:
headlines.append(get_headlines(year))
except Exception as e:
print(e)
headlines.append(get_headlines(1994, start_month='July'))
headlines.append(get_headlines(2020, end_month='November'))
with o... | 3 | 3 |
maintenance/templates/nodeclass.py | JFlynnXYZ/pymel | 287 | 44394 | <gh_stars>100-1000
{% if not existing %}
class {{ classname }}({{ parents }}):
{% endif %}
{% if attrs %}
{% for attr in attrs %}
{% for line in attr.getLines() %}
{{line}}
{% endfor %}
{% endfor %}
{% endif %}
{% if methods %}
{% for method in methods %}
{% for line in method.getLines() %}
{{line}}
... | 1.78125 | 2 |
examples/IMPALA/atari_agent.py | alexqdh/PARL | 0 | 44395 | <filename>examples/IMPALA/atari_agent.py
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licens... | 2.203125 | 2 |
robotSrv/constants.py | JDownloader/GEL-3014_Design3 | 0 | 44396 | <gh_stars>0
ROBOT_POSITION_RESSOURCE = '/robotposition'
CUBE_POSITION_RESSOURCE = '/cubeposition'
PATH_RESSOURCE = '/path'
FLAG_RESSOURCE = '/flag' | 1.101563 | 1 |
shatter/util/helpers.py | jisazaTappsi/mastermind | 1 | 44397 | #!/usr/bin/env python
"""Utility and General purpose functions."""
import inspect
import warnings
import os
import re
import shatter.constants as cts
__author__ = '<NAME>'
def read_file(absolute_path):
"""
:param absolute_path: string path.
:return: list with lines of the file.
"""
return [line... | 2.96875 | 3 |
yasql/apps/sqlquery/migrations/0001_initial.py | Fanduzi/YaSQL | 443 | 44398 | <reponame>Fanduzi/YaSQL<gh_stars>100-1000
# Generated by Django 2.2.16 on 2020-12-15 07:18
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('sqlorders', '0001_initial'),... | 1.726563 | 2 |
tests/main_pubsub.py | meloncookie/JsMeetsStarlette | 4 | 44399 | <filename>tests/main_pubsub.py
import typing
import asyncio
import json
from starlette.responses import PlainTextResponse
from JsMeetsStarlette import (JsMeetsPy, JsPyError, JsPyTextSocket,
JsPyPubsub, JsPyFunction)
# Access http://xxx/static/index_pubsub.html
app = JsMeetsPy(debu... | 2.53125 | 3 |