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 |
|---|---|---|---|---|---|---|
satchmo/apps/product/urls/category.py | predatell/satchmo | 1 | 12777851 | from django.conf.urls import url
from product.views import CategoryView, CategoryIndexView
urlpatterns = [
url(r'^(?P<parent_slugs>([-\w]+/)*)?(?P<slug>[-\w]+)/$', CategoryView.as_view(), name='satchmo_category'),
url(r'^$', CategoryIndexView.as_view(), name='satchmo_category_index'),
] | 1.625 | 2 |
gammapy/modeling/sampling.py | QRemy/gammapy | 0 | 12777852 | <gh_stars>0
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""MCMC sampling helper functions using ``emcee``."""
import logging
import numpy as np
__all__ = ["uniform_prior", "run_mcmc", "plot_trace", "plot_corner"]
log = logging.getLogger(__name__)
# TODO: so far only works with a uniform prior on... | 2.171875 | 2 |
5/cvicenie/sections/module_4.py | sevo/FLP-2020 | 0 | 12777853 | #
# Section 4: Somehow harder exercises
#
# This section covers regular expressions, input and output, the use of higher-
# order-functions and a little more advanced loops.
#
from collections import defaultdict
import random, re
# 42. Sentence Splitter
# Given a text file, this program separates its sentences based
... | 4.3125 | 4 |
services/ATM-machine/client/client.py | HackerDom/ctfcup-2021-AD | 0 | 12777854 | import socket
from enum import IntEnum
from typing import Dict, List
from base64 import b64decode, b64encode
UTF_8 = 'utf-8'
class Stage(IntEnum):
START = 1
TRANSFER = 2
CHECKID = 3
CHECK = 4
SHOW = 5
SEND = 6
class BaseMsg:
def get_bytes(self) -> bytes:
return str(self).encod... | 2.6875 | 3 |
reportParsing/auditReport_1_auditor.py | ypspy/disclosureSimilarity | 0 | 12777855 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 13 15:19:08 2020
@author: user
"""
from bs4 import BeautifulSoup
import os
import glob
import pandas as pd
import numpy as np
from tqdm import tqdm
# 1. 작업 폴더로 변경
os.chdir("C:\data\\") # 작업 폴더로 변경
# 2. 타겟 폴더에 있는 필요 문서 경로 리스트업
pathList = []
for path in tqdm... | 2.09375 | 2 |
mytrade/form/fields.py | hellwen/mytrade | 0 | 12777856 | import time
import datetime
import itertools
from wtforms import fields#, widgets
try:
from wtforms.fields import _unset_value as unset_value
except ImportError:
from wtforms.utils import unset_value
from .widgets import (
DateTimePickerWidget,
TimePickerWidget,
Select2Widget,
Select2TagsWidge... | 3 | 3 |
novel_tools/processors/transformers/path_transformer.py | ALMSIVI/novel_tools | 1 | 12777857 | from pathlib import Path
from novel_tools.framework import Processor
from novel_tools.common import NovelData, ACC, FieldMetadata
class PathTransformer(Processor, ACC):
"""
Given `in_dir`, this transformer will replace all `Path` fields with the paths relative to its `in_dir`.
"""
@staticmethod
d... | 2.578125 | 3 |
prediction/views.py | enisteper1/AWS-Deployed-ML | 0 | 12777858 | <gh_stars>0
from django.shortcuts import render
from django.http import HttpResponse
from datetime import datetime
from prediction.models import Data
from .forms import DataForm
from .titanic_automated_prediction import predict_person
# Create your views here.
def main(request):
if request.method == "POST":
... | 2.65625 | 3 |
troposphere/openstack/heat.py | jpvowen/troposphere | 1 | 12777859 | # -*- coding: utf-8 -*-
"""
Openstack Heat
--------------
Due to the strange nature of the OpenStack compatability layer, some values
that should be integers fail to validate and need to be represented as
strings. For this reason, we duplicate the AWS::AutoScaling::AutoScalingGroup
and change these types.
"""
# Copyri... | 1.484375 | 1 |
ixbrl_parse/dataframe.py | cybermaggedon/ixbrl-parse | 1 | 12777860 |
import pandas as pd
def values_to_df(values):
data = []
for n, v in values.items():
data.append([
n.localname, v.to_value().get_value(), v.unit
])
return pd.DataFrame(
data,
columns = ["name", "value", "unit"]
)
def instance_to_df(inst):
columns = [... | 2.71875 | 3 |
geoscreens/labelstudio/core.py | GiscardBiamby/geo | 1 | 12777861 | import json
import sys
from copy import deepcopy
from pathlib import Path
from typing import Dict, List, Optional, Set, Tuple, Union, cast
from label_studio_sdk import Client, Project
from requests import Response
from tqdm.contrib.bells import tqdm
def get_labelstudio_export_from_api(
project: Project, export_t... | 2.234375 | 2 |
app.py | GeethZin/Biosphere | 0 | 12777862 | import flask
import pyodbc
# Initializes app and database connection
app = flask.Flask('biosphere', template_folder='templates')
db_conn = conn = pyodbc.connect(
'Driver={SQL Server};'
'Server=DESKTOP-QR078NF\SQLEXPRESS;'
'Database=BIOSPHERE;'
'Trusted_Connection=yes;'
)
# Function to hand... | 2.734375 | 3 |
classes/basic_cfg.py | A26mike/Arma-Python-server-manager | 0 | 12777863 | <reponame>A26mike/Arma-Python-server-manager
class BasicCFG:
"""BasicCFG [CFG Calculator for undocumented ]
Args:
uploadSpeed ([int]): [In MB/s]
socket_init ([int]): [description]
socket_min ([int]): [description]
maxPacketSize (int, optional): [ISP MTU setti... | 2.46875 | 2 |
Basic_ML/Quantum_Tic_Tac_Toe/tic_tac_toe.py | jrclimer/Projects | 27 | 12777864 | import itertools
import copy
import re
import math
import random
import shelve
class board(object):
def __init__(self,humans=0,AI1=None,AI2=None):
self.board = {(1,1):[],\
(1,2):[],\
(1,3):[],\
(2,1):[],\
(2,2):[],\
... | 3.890625 | 4 |
python/test/cuda/test_large_blocks.py | daniel-falk/nnabla-ext-cuda | 103 | 12777865 | <gh_stars>100-1000
# Copyright 2017,2018,2019,2020,2021 Sony Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | 2 | 2 |
Python/keithley-2400_mpps.py | jmball/simple_solar_simulator | 0 | 12777866 | import argparse
import time
import numpy as np
import pyvisa
# Parse folder path, file name, and measurement parameters from command line
# arguments. Remember to include the "python" keyword before the call to the
# python file from the command line, e.g. python example.py "arg1" "arg2".
# Folder paths must use for... | 2.921875 | 3 |
Advanced/Exams/2020_10_Exam/2_checkmate.py | tankishev/Python | 2 | 12777867 | <reponame>tankishev/Python
# You will be given a chess board (8x8). On the board there will be 3 types of symbols:
# • "." – empty square
# • "Q" – a queen
# • "K" – the king
# Your job is to find which queens can capture the king and print them. The moves that the queen can do is to move
# diagonally, horizontally and... | 4.15625 | 4 |
imagelib/image/image_writers/__init__.py | susautw/imagelib | 0 | 12777868 | __all__ = ['ImageWriter', 'BlockingImageWriter', 'ThreadingImageWriter']
from .image_writer import ImageWriter
from .blocking_image_writer import BlockingImageWriter
from .threading_image_writer import ThreadingImageWriter
| 1.523438 | 2 |
lib/color.py | runblood/get_mysql_stats | 2 | 12777869 | #!/usr/local/bin/python3.6
#-*- coding: utf-8 -*-
#Author WangJiang@2019 15810438848 <EMAIL>
#All rights reserved
################################################################################################################
from colorama import init, Fore, Back, Style
###############################################... | 2.8125 | 3 |
local/pre-computing.py | Ririkoo/DanmakuAnime | 0 | 12777870 | <gh_stars>0
# -*- coding: utf-8 -*-
from multiprocessing.dummy import Pool as ThreadPool
from bilisupport import DANMAKULIST,EPISODEINFO,DANMAKURES,OTHERINFO
import os
import re
import requests
import numpy as np
from datetime import datetime
from zhon.hanzi import punctuation
from bs4 import BeautifulSoup
punctuation+... | 2.46875 | 2 |
tests/test_main.py | diogobaeder/convertfrom | 0 | 12777871 | from unittest import TestCase
from unittest.mock import patch
from nose.tools import istest
from convertfrom.main import convert, main
class EntryPointTest(TestCase):
@istest
@patch('convertfrom.main.sys')
@patch('convertfrom.main.print')
@patch('convertfrom.main.convert')
def prints_converted_r... | 2.625 | 3 |
others/jacobian.py | raghuramshankar/kalman-filter-localization | 3 | 12777872 | <gh_stars>1-10
import sympy as sp
x, y, psi, v, dpsi, T = sp.symbols('x y psi v dpsi T')
state = sp.Matrix([x,
y,
psi,
v,
dpsi])
F = sp.Matrix([[x + (v/dpsi) * (sp.sin(T * dpsi + psi) - sp.sin(psi))],
[y + (v/dpsi) ... | 2.046875 | 2 |
segmentation/rescore.py | PRHLT/docClasifIbPRIA22 | 0 | 12777873 | <filename>segmentation/rescore.py
import glob, os, re
import numpy as np
import math
def read_results(paths:list, LOG:bool=False) -> dict:
res = {}
min_pag = 1500
for path in paths:
# print("Reading results from : ", path)
f = open(path, "r")
lines = f.readlines()
f.close()
... | 2.546875 | 3 |
applications/extract_test_cold_questions.py | zhenv5/PyStack | 7 | 12777874 | <filename>applications/extract_test_cold_questions.py
try:
import cPickle as pickle
except Exception as e:
import pickle
import pandas as pd
import os.path
import random
def process_ques_asker(cate_name):
asker_df = pd.read_csv(os.path.join(cate_name,"QuestionId_AskerId.csv"))
ques_asker_dict = {k:v for k,v in ... | 2.6875 | 3 |
letcon/src/utils/__init__.py | llFireHawkll/letcon2020-ml-workshop | 3 | 12777875 | <filename>letcon/src/utils/__init__.py
'''
File: __init__.py
Project: utils
File Created: Tuesday, 18th August 2020 12:26:46 am
Author: <NAME> (<EMAIL>)
-----
Last Modified: Tuesday, 18th August 2020 12:26:46 am
Modified By: <NAME> (<EMAIL>>)
-----
Copyright 2020 <NAME>
'''
| 1.304688 | 1 |
lunchbot/services.py | vekerdyb/lunchbot | 2 | 12777876 | import os
import boto3
from slackclient import SlackClient
from lunchbot import logging
logger = logging.getLogger(__name__)
class Slack(object):
client = None
@staticmethod
def get_client():
if Slack.client is not None:
logger.debug("Using cached Slack client")
return... | 2.171875 | 2 |
PPIG/Linear_VAE/linear_gae/train.py | ComputeSuda/PPICT | 0 | 12777877 | from __future__ import division
from __future__ import print_function
from evaluation import get_roc_score, clustering_latent_space
from input_data import load_adj_feature
from kcore import compute_kcore, expand_embedding
from model import *
from optimizer import OptimizerAE, OptimizerVAE
from preprocessing impo... | 2.03125 | 2 |
Incident-Response/Tools/cyphon/cyphon/aggregator/filters/tests/test_models.py | sn0b4ll/Incident-Playbook | 1 | 12777878 | # -*- coding: utf-8 -*-
# Copyright 2017-2019 ControlScan, Inc.
#
# This file is part of Cyphon Engine.
#
# Cyphon Engine 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, version 3 of the License.
#
# Cyphon En... | 1.90625 | 2 |
XGBoost/XGBoost_v3/gbtree_xrh.py | Xinrihui/Statistical-Learning-Method | 2 | 12777879 | <reponame>Xinrihui/Statistical-Learning-Method<filename>XGBoost/XGBoost_v3/gbtree_xrh.py<gh_stars>1-10
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import time
import os
import pickle
from sklearn import datasets
from sklearn.datasets import load_boston
from sklearn.model_selection import train_test_split
from sklearn.m... | 2.40625 | 2 |
docs/reorder_divs.py | ccmaymay/concrete | 15 | 12777880 | #!/usr/bin/env python3
# This file reads in "HTML" from a call to
# thrift --gen html ....
# and does some post-processing to it.
# 1. It wraps struct headers + div definitions
# in a div.
# 2. It reorders struct divs to be alphabetically
# ordered.
from bs4 import BeautifulSoup
import fileinput
import loggin... | 2.9375 | 3 |
turtle2.py | agam21-meet/meet2019y1lab1 | 0 | 12777881 | <reponame>agam21-meet/meet2019y1lab1<filename>turtle2.py
import turtle
turtle.penup()
turtle.goto(-200,-100)
turtle.pendown()
turtle.goto(-200,-100+200)
turtle.goto(-200+50,-100)
turtle.goto(-200+100,-100+200)
turtle.goto(-200+100,-100)
turtle.penup()
turtle.goto(-200+150,-100+200)
turtle.pendown()
turtle.goto(-200+1... | 2.421875 | 2 |
misc/var_calcs.py | dmitbor/pointless-war | 0 | 12777882 | import math
def two_point_distance(x1, y1, x2, y2):
"""
Calculates distance between two given points.
x1 - X Value of Point 1
y1 - Y Value of Point 1
x2 - X Value of Point 2
y2 - Y Value of Point 2
"""
return math.fabs(math.hypot(x2 - x1, y2 - y1))
def get_closest_enemy(search_squa... | 3.5625 | 4 |
tests/__init__.py | francois-vincent/docker_orchestrator | 0 | 12777883 | # encoding: utf-8
import sys
| 1.0625 | 1 |
Educational Round #82 (Div 2)/A.py | julianferres/Codeforces | 4 | 12777884 | from collections import Counter
t = int(input())
for _ in range(t):
s = input()
firstOne = -1
lastOne = -1
for i in range(len(s)):
if s[i] == '1':
if firstOne == -1:
firstOne = i
else:
lastOne = i
if firstOne > -1 and lastOne > -1:
... | 3.28125 | 3 |
dstk/tests/test_preprocessing.py | joseph-jnl/ds-toolkit | 0 | 12777885 | import numpy as np
import pandas as pd
from dstk.preprocessing import (onehot_encode,
mark_binary,
nan_to_binary,
num_to_str)
# Create test data
df = pd.DataFrame()
df['numeric1'] = [0, 1, 0, 0, 1, 1]
df['numeric2'] = [1.0... | 2.9375 | 3 |
src/tasks/santa_fe_trail/implements/field.py | technote-space/genetic-algorithms-py | 3 | 12777886 | import copy
from typing import MutableMapping
from .field_flags import FieldFlags
from .helper import Helper
class Field:
"""
Description:
------------
Field
"""
__ate: int
__field: MutableMapping[int, FieldFlags]
__foods: int
def __init__(self) -> None:
self.__ate = 0
... | 2.703125 | 3 |
tests/test_0231-indexform.py | BioGeek/awkward-1.0 | 519 | 12777887 | # BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE
from __future__ import absolute_import
import pytest # noqa: F401
import numpy as np # noqa: F401
import awkward as ak # noqa: F401
def test():
for itype in ["i8", "u8", "i32", "u32", "i64"]:
form = ak.forms.ListO... | 1.695313 | 2 |
src/tensorforce/tensorforce/agents/__init__.py | linus87/drl_shape_optimization | 17 | 12777888 | # Copyright 2018 Tensorforce Team. 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 la... | 1.53125 | 2 |
bin/run_twitter_client.py | kubor/chem_bot | 2 | 12777889 | <filename>bin/run_twitter_client.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from chem_bot import twitter as T
def _main():
config = T.Config()
config.load()
api = T.oauth(config)
stream = T.Streamer(api, config)
stream.statuses.filter(track=config.query, follow=config.filter_follow)
# ... | 2.15625 | 2 |
surveymonty/exceptions.py | andrewkshim/surveymonty | 15 | 12777890 | <reponame>andrewkshim/surveymonty
"""
surveymonty.exceptions
----------------------
"""
class SurveyMontyError(Exception):
"""Base exception."""
pass
class SurveyMontyAPIError(SurveyMontyError):
"""Error for non-2xx API responses."""
def __init__(self, resp, *args):
super(SurveyMontyAPIErro... | 2.5625 | 3 |
tftpy/context/server.py | jcarswell/tftpy | 0 | 12777891 | import logging
import time
from io import IOBase
from typing import Callable
from typing import Any
from .base import Context
from tftpy.states import Start
logger = logging.getLogger('tftpy.context.server')
class Server(Context):
"""The context for the server."""
def __init__(self, host... | 2.5625 | 3 |
admin/c2cgeoportal_admin/views/layer_groups.py | vvmruder/c2cgeoportal | 0 | 12777892 | from functools import partial
from pyramid.view import view_defaults
from pyramid.view import view_config
from c2cgeoform.schema import GeoFormSchemaNode
from c2cgeoform.views.abstract_views import ListField
from deform.widget import FormWidget
from c2cgeoportal_admin.schemas.treegroup import children_schema_node
fro... | 1.726563 | 2 |
noise-removal/test/test_noise_removal_client.py | audo-ai/audoai-python | 1 | 12777893 | import os
import wave
from io import BytesIO, BufferedIOBase
from tempfile import NamedTemporaryFile
import pytest
from audoai.noise_removal import NoiseRemovalClient
@pytest.fixture()
def noise_removal() -> NoiseRemovalClient:
api_key = os.environ['AUDO_API_KEY']
base_url = os.environ['AUDO_BASE_URL']
n... | 2.171875 | 2 |
NER/rule_base_ner.py | SatoMichi/Information_Extraction_Basic | 0 | 12777894 | import re
from janome.tokenizer import Tokenizer
# rules : {boolean function(word):label}
# txt: str
def rule_base_ner(rules,txt):
tokenizer = Tokenizer()
tokens = tokenizer.tokenize(txt)
history = []
for t in tokens:
word = t.surface
for rule,label in rules.items():
if rule... | 2.96875 | 3 |
test/test_wordcounter.py | williezh/linuxtools | 13 | 12777895 | <reponame>williezh/linuxtools
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, division, unicode_literals
import os, sys
from unittest import TestCase, main
from collections import Counter
parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0,pa... | 2.53125 | 3 |
output/models/ms_data/additional/test72597_xsd/test72597.py | tefra/xsdata-w3c-tests | 1 | 12777896 | <filename>output/models/ms_data/additional/test72597_xsd/test72597.py
from dataclasses import dataclass, field
from typing import List, Optional
__NAMESPACE__ = "foo"
@dataclass
class A:
part: List["A.Part"] = field(
default_factory=list,
metadata={
"type": "Element",
"nam... | 2.328125 | 2 |
trio_cdp/generated/runtime.py | vcalvert/trio-chrome-devtools-protocol | 37 | 12777897 | <reponame>vcalvert/trio-chrome-devtools-protocol
# DO NOT EDIT THIS FILE!
#
# This code is generated off of PyCDP modules. If you need to make
# changes, edit the generator and regenerate all of the modules.
from __future__ import annotations
import typing
from ..context import get_connection_context, get_session_con... | 1.71875 | 2 |
scripts/exercicios/ex010.py | RuanBarretodosSantos/python | 0 | 12777898 | <filename>scripts/exercicios/ex010.py
from email.utils import collapse_rfc2231_value
real = float(input('Quantos reais você tem ? R$ '))
dolar = real / 5.16
euro = real / 5.77
print(f'Com {real} você consegue comprar {dolar:.2f} dólares ou {euro:.2f}') | 2.28125 | 2 |
src/main.py | TRex22/picam | 1 | 12777899 | # Notes:
# For fixing multi-press See: https://raspberrypi.stackexchange.com/questions/28955/unwanted-multiple-presses-when-using-gpio-button-press-detection
# Supported file types: https://picamera.readthedocs.io/en/release-1.10/api_camera.html#picamera.camera.PiCamera.capture
# 'jpeg' - Write a JPEG file
# 'png... | 1.882813 | 2 |
Algorithm/BOJ/Gold/1915가장큰정사각형.py | Nyapy/FMTG | 0 | 12777900 | <gh_stars>0
import sys
sys.stdin = open("1915.txt")
n, m = map(int, sys.stdin.readline().split())
array = [list(map(int, sys.stdin.readline().rstrip())) for _ in range(n)]
dp = [[0 for _ in range(m)] for _ in range(n)]
ans = 0
for i in range(n):
if array[i][0] == 1:
dp[i][0] = 1
ans = 1
for j i... | 2.0625 | 2 |
ores/scoring/models/rev_id_scorer.py | elukey/ores | 69 | 12777901 | import time
from revscoring import Datasource, Feature, Model
from revscoring.datasources.revision_oriented import revision
from revscoring.scoring import ModelInfo
from revscoring.scoring.statistics import Classification
def process_last_two_in_rev_id(rev_id):
last_two = str(rev_id)[-2:]
if len(last_two) ==... | 2.640625 | 3 |
rest_framework/signals.py | blackjackgg/drf-with-history-track | 1 | 12777902 | # -*- coding: utf-8 -*-
# 创建信号
import datetime
import dictdiffer
from django.dispatch import Signal
from django.apps import apps as django_apps
import json
def format_value(value):
"""格式化数据"""
if isinstance(value, datetime.datetime):
return value.strftime('%Y-%m-%d %H:%M:%S')
return value
def s... | 2.34375 | 2 |
dist_helper.py | ymwdalex/Segmented-shape-symbolic-time-series-representation- | 2 | 12777903 | #!/usr/bin/env python
#########################################################
# #
# Segmented Shape-Symbolic Time series Representation #
# #
# __author__ = "<NAME>"
# __copyright__ = "Copyright 2013, T... | 2.53125 | 3 |
manhattan/record.py | cartlogic/manhattan | 1 | 12777904 | from __future__ import absolute_import, division, print_function
log_version = 1
class Record(object):
base_fields = ('timestamp', 'vid', 'site_id')
fields = ()
def __init__(self, **kwargs):
for field in self.base_fields + self.fields:
setattr(self, field, kwargs.get(field, ''))
... | 2.40625 | 2 |
setup.py | rapatchi/SFMergeUtility | 0 | 12777905 | <reponame>rapatchi/SFMergeUtility
from setuptools import setup, find_packages
setup(
name='SFMergeUtility',
version='0.1',
packages=find_packages(exclude=['tests*']),
license='MIT',
description='SFMergeUtility',
long_description=open('README.md').read(),
install_requires=[''],
url='',
... | 1.023438 | 1 |
cross2sheet/main.py | jaylorch/cross2sheet | 10 | 12777906 | <filename>cross2sheet/main.py
#!/usr/bin/python
import argparse
import urllib.request
from cross2sheet.excel import save_xlsx
from cross2sheet.html14 import parse_html_grid
from cross2sheet.htmltable import parse_html_table
from cross2sheet.transforms import autonumber, outside_bars, pad
def read(string):
if '://... | 2.84375 | 3 |
scripts/problem0003.py | Joel301/Project_Euler | 0 | 12777907 | <reponame>Joel301/Project_Euler
#! python3
#-*- coding: utf-8 -*-
"""
Euler description from https://projecteuler.net/
Problem 0003
The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143 ?
"""
def primeFactors(number= 13195):
p=2
while number >= p*p:
if number... | 3.359375 | 3 |
tests/test_titles.py | openstack/api-wg | 33 | 12777908 | # 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 writing, software
# distributed under t... | 2.359375 | 2 |
lights/admin.py | and-dmitry/demolighting | 0 | 12777909 | from django.contrib import admin
from . import models
@admin.register(models.Lamp)
class LampAdmin(admin.ModelAdmin):
list_display = ('name', 'is_on', 'brightness')
ordering = ('name',)
@admin.register(models.WorkingPeriod)
class WorkingPeriodAdmin(admin.ModelAdmin):
list_display = ('lamp', 'brightne... | 1.859375 | 2 |
lizardanalysis/version.py | JojoReikun/ClimbingLizardDLCAnalysis | 1 | 12777910 | <gh_stars>1-10
"""
LizardDLCAnalysis Toolbox
© <NAME>
© <NAME>
Licensed under MIT License
"""
__version__ = '0.1'
VERSION = __version__ | 1.023438 | 1 |
test/service/test_response.py | NoopDog/azul | 0 | 12777911 | import json
from typing import (
Any,
Dict,
List,
Optional,
)
import unittest
from unittest import (
mock,
)
import urllib.parse
from more_itertools import (
one,
)
import requests
from app_test_case import (
LocalAppTestCase,
)
from azul import (
cached_property,
config,
)
from az... | 2.09375 | 2 |
examples/learning/reinforcement/upswing/_model/double_pendulum.py | JonathanLehner/korali | 43 | 12777912 | <filename>examples/learning/reinforcement/upswing/_model/double_pendulum.py
#!/user/bin/env python3
## Copyright (c) 2018 CSE-Lab, ETH Zurich, Switzerland. All rights reserved.
## Distributed under the terms of the MIT license.
##
## Created by <NAME> (<EMAIL>).
import math
from math import sin, cos
import numpy a... | 2.828125 | 3 |
ungit.py | jakebruce/qutico-8 | 0 | 12777913 | #! /usr/bin/env python3
import os
import sys
def error(msg):
print(msg)
print(f"Usage: {sys.argv[0]} FILE.gitp8")
print(" Converts FILE.gitp8 in merge-friendly format to FILE.p8 in pico-8 format.")
sys.exit(1)
if len(sys.argv) < 2 or len(sys.argv) > 2:
error("Exactly 1 argument required.")
if n... | 2.8125 | 3 |
func/Functions.py | cviaai/unsupervised-heartbeat-anomaly-detection | 2 | 12777914 | <reponame>cviaai/unsupervised-heartbeat-anomaly-detection<gh_stars>1-10
import pandas as pd
import numpy as np
import sys,os
import time
import biosppy
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import scipy
from sliding.ecg_slider import ECGSlider
from sliding.slider import Slider
from sta... | 2.359375 | 2 |
wildfire/multiprocessing.py | Ferrumofomega/goes | 1 | 12777915 | """Utilities for multiprocessing."""
from contextlib import contextmanager
import logging
import time
from dask.distributed import Client, LocalCluster, progress
from dask_jobqueue import PBSCluster
import numpy as np
_logger = logging.getLogger(__name__)
def map_function(function, function_args, pbs=False, **clust... | 2.75 | 3 |
examples/random_dataguy.py | redfungus/webtraversallibrary | 41 | 12777916 | <reponame>redfungus/webtraversallibrary<gh_stars>10-100
# 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 Apac... | 2.1875 | 2 |
2020/1/main.py | klrkdekira/adventofcode | 1 | 12777917 | with open('input') as file:
prev = []
found_twins = False
found_triplets = False
for val in map(int, map(lambda i: i.strip(), file)):
for x in prev:
if not found_twins and x + val == 2020:
print('twins', x * val)
found_twins = True
for y... | 3.375 | 3 |
samples/awsCall/awsCall.py | aws-samples/cloudwatch-custom-widgets-samples | 12 | 12777918 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
# CloudWatch Custom Widget sample: call any read-only AWS API and return raw results in JSON
import boto3
import json
import os
import re
DOCS = """
## Make an AWS Call
Calls any (read-only) AWS API and displays the ... | 2.46875 | 2 |
testlogging/tests/test_handler.py | freeekanayaka/testlogging | 0 | 12777919 | import time
from testtools import TestResult
from logging import (
Formatter,
Logger,
INFO,
)
from six import b
from mimeparse import parse_mime_type
from testtools import TestCase
from testlogging import SubunitHandler
from testlogging.testing import StreamResultDouble
class SubunitHandlerTest(Test... | 2.421875 | 2 |
py/spider/miscellany/Airlines_xiecheng_seating.py | 7134g/mySpiderAll | 0 | 12777920 | <filename>py/spider/miscellany/Airlines_xiecheng_seating.py
from copy import copy
from pprint import pprint
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import Unexpec... | 2.3125 | 2 |
Step-3-DeepQLearning/main.py | kasey-/ArduinoDQNCar | 4 | 12777921 | import numpy as np
import gym
import gym_carsim
from gym import spaces
from keras.models import Sequential
from keras.layers import Dense, Activation, Flatten
from keras.optimizers import Adam
from rl.agents.dqn import DQNAgent
from rl.policy import BoltzmannQPolicy
from rl.memory import SequentialMemory
ENV_NAME = ... | 2.25 | 2 |
pytimeNSW/pytimeNSW.py | MatthewBurke1995/PyTimeNSW | 0 | 12777922 | #!/usr/bin/env python
# encoding: utf-8
"""
pytimeNSW
~~~~~~~~~~~~~
A easy-use module to solve the datetime needs by string.
:copyright: (c) 2017 by <NAME> <<EMAIL>>
:license: MIT, see LICENSE for more details.
"""
import datetime
import calendar
from .filter import BaseParser
bp = BaseParser.... | 3.71875 | 4 |
ensemble/__init__.py | wwyf/pyml | 0 | 12777923 | from pyml.tree.regression import DecisionTreeRegressor
from pyml.metrics.pairwise import euclidean_distance
import numpy as np
# TODO: 使用平方误差,还是绝对值误差,还是Huber Loss
class GradientBoostingRegression():
def __init__(self,
learning_rate=0.1,
base_estimator=DecisionTreeRegressor,
n_estimators=500... | 2.765625 | 3 |
tests/test_set5.py | svkirillov/cryptopals-python3 | 0 | 12777924 | class TestSet5:
def test_challenge33(self):
from cryptopals.set5.challenge33 import challenge33
assert challenge33(), "The result does not match the expected value"
def test_challenge34(self):
from cryptopals.set5.challenge34 import challenge34
assert challenge34(), "The resul... | 2.734375 | 3 |
examples/readme.py | elsholz/PyMarkAuth | 2 | 12777925 | from pymarkauth import MarkDown
with MarkDown('../README.md') as doc:
sec = doc.section("PyMarkAuth")
sec.paragraphs(
'With PyMarkAuth you can author markdown code simply from python code.'
' To view the source code that generated this readme, take a look at the examples directory!',
)
... | 3.046875 | 3 |
src/gausskernel/dbmind/tools/ai_server/service/datafactory/collector/agent_collect.py | Yanci0/openGauss-server | 360 | 12777926 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
#############################################################################
# Copyright (c): 2021, Huawei Tech. Co., Ltd.
# FileName : agent_collect.py
# Version :
# Date : 2021-4-7
# Description : Receives and stores agent data.
###########################... | 2.375 | 2 |
posting.py | syjang/autoblog | 1 | 12777927 | from selenium import webdriver
from realtimekeyword import getNaverRealtimekeyword
import time
from bs4 import BeautifulSoup
class TistoryPostingBot:
def __init__(self,driver, dir, id,password):
self.id = id
self.dir =dir
self.password = password
self.driver = driver
retur... | 2.59375 | 3 |
flskweb/app/forms.py | yunpochen/yunpochenex | 0 | 12777928 | #form.py
from flask_wtf import FlaskForm
from wtforms import StringField , PasswordField , SubmitField , BooleanField #導入用途是為了建立表單
from wtforms.validators import DataRequired, Length , Email , EqualTo , ValidationError #導入用途是為了建立表單 ValidationError是檢視重複輸入
from app.models import User
class RegisterForm(Flask... | 2.984375 | 3 |
model.py | yvesscherrer/stanzatagger | 0 | 12777929 | # was stanza.models.pos.model
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.utils.rnn import pad_packed_sequence, pack_padded_sequence, pack_sequence, PackedSequence
from biaffine import BiaffineScorer
from hlstm import HighwayLSTM
from dropout import WordDropout
... | 2.1875 | 2 |
heat/engine/resources/openstack/barbican/order.py | maestro-hybrid-cloud/heat | 0 | 12777930 | #
# 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 writing, software
# ... | 1.679688 | 2 |
zero/patrickstar_utils/utils.py | Wesley-Jzy/ColossalAI-Benchmark | 39 | 12777931 | import os
import torch
from zero.common.utils import CONFIG, get_gpu_memory_mb, print_log
from torch.distributed import init_process_group
def init_w_ps(builder):
from patrickstar.runtime import initialize_engine
config = CONFIG.copy()
rank = int(os.environ['RANK'])
world_size = int(os.environ['WOR... | 2.09375 | 2 |
tools.py | vinx13/WikiCrawler | 0 | 12777932 | <reponame>vinx13/WikiCrawler
import DbHelper
def singleton(_class):
"""
a decorator that is used to implement singleton patten;
Usage:
@singleton
class Foo:
pass
"""
instances = {}
def _getInstance(*args, **kwargs):
if _class not in insta... | 3.28125 | 3 |
src/markdown_exec/pycon.py | pawamoy/markdown-exec | 0 | 12777933 | <reponame>pawamoy/markdown-exec
"""Formatter for executing `pycon` code."""
from __future__ import annotations
import textwrap
from typing import Any
from markdown.core import Markdown
from markdown_exec.python import run_python
from markdown_exec.rendering import add_source, markdown
def format_pycon( # noqa: W... | 2.828125 | 3 |
docker/turtlebot2i_deep_qlearning/turtlebot2i_deep_qlearning/dqn/respawnGoal.py | EricssonResearch/tnmt | 0 | 12777934 | #!/usr/bin/env python
import rospy
import random
import time
import os
from gazebo_msgs.srv import SpawnModel, DeleteModel
from gazebo_msgs.msg import ModelStates
from geometry_msgs.msg import Pose
import pdb;
class Respawn():
def __init__(self):
self.modelPath = os.path.dirname(os.path.realpath(__file__))... | 2.59375 | 3 |
test/test_digital_signature_transaction.py | signingtoday/signingtoday-sdk-python | 0 | 12777935 | <gh_stars>0
# coding: utf-8
"""
Signing Today Web
*Signing Today* is the perfect Digital Signature Gateway. Whenever in Your workflow You need to add one or more Digital Signatures to Your document, *Signing Today* is the right choice. You prepare Your documents, *Signing Today* takes care of all the rest: se... | 2.078125 | 2 |
code/displayData.py | Tobiaskri/Heart-Rate-Measurement | 0 | 12777936 | <filename>code/displayData.py<gh_stars>0
import cv2
import numpy as np
from matplotlib import pyplot as plt
def display(in_signal):
return 0
| 2.046875 | 2 |
tests/functional/test_cookiecutter.py | cjolowicz/cutty | 1 | 12777937 | <filename>tests/functional/test_cookiecutter.py
"""Functional tests for the cookiecutter CLI."""
from pathlib import Path
import pytest
from cutty.projects.projectconfig import PROJECT_CONFIG_FILE
from cutty.util.git import Repository
from tests.functional.conftest import RunCutty
from tests.functional.conftest impor... | 2.375 | 2 |
tests/test_util.py | EarthObservationSimulator/orbits | 4 | 12777938 | """Unit tests for orbitpy.util module.
"""
import unittest
import numpy as np
from numpy.core.numeric import tensordot
from instrupy.util import Orientation
from instrupy import Instrument
from orbitpy.util import OrbitState, SpacecraftBus, Spacecraft
import orbitpy.util
import propcov
from util.spacecrafts import sp... | 2.640625 | 3 |
tests/spec2k/extract_timings.py | kapkic/native_client | 1 | 12777939 | #!/usr/bin/python2
# Copyright (c) 2011 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.
# This script produces csv data from multiple benchmarking runs with the
# spec2k harness.
#
# A typical usage would be
#
# expor... | 2.359375 | 2 |
chumpy/np_tensordot.py | Syze/chumpy | 5 | 12777940 | <reponame>Syze/chumpy
# Up to numpy 1.13, the numpy implementation of tensordot could be
# reinterpreted using chumpy. With numpy 1.14 the implementation started using
# ufunc.multiply.reduce which can't be understood by chumpy. This is the
# chumpy-compatible implementation of tensodrot from numpy 1.13.3.
#
# i.e.
#
#... | 2.171875 | 2 |
modules/pyxmpp2/expdict.py | gthreepwood/yats | 0 | 12777941 | <filename>modules/pyxmpp2/expdict.py
#
# (C) Copyright 2003-2011 <NAME> <<EMAIL>>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License Version
# 2.1 as published by the Free Software Foundation.
#
# This program is distributed in the hope... | 2.125 | 2 |
semi_supervised_learning/bayesian_gan_resgmcmc.py | gaoliyao/Replica_Exchange_Stochastic_Gradient_MCMC | 21 | 12777942 | import os
import sys
import argparse
import json
import time
import numpy as np
from math import ceil
from PIL import Image
import tensorflow as tf
from tensorflow.contrib import slim
from bgan_util import AttributeDict
from bgan_util import print_images, MnistDataset, CelebDataset, Cifar10, Cifar100, SVHN, ImageNe... | 2.328125 | 2 |
jssmanifests/models.py | aysiu/manana | 9 | 12777943 | <filename>jssmanifests/models.py
from django.db import models
from django.conf import settings
from django.contrib.auth.models import User, Group
from reports.models import BusinessUnit
from manifests.models import Manifest
from datetime import datetime, timedelta
from jssmanifests.jsshelper import fetch_account_si... | 2.015625 | 2 |
leetcode/dp/removeInvalidParentheses.py | BennyJane/algorithm_mad | 0 | 12777944 | from typing import List
# 经典题目:多种解决方案对比,技巧比较多
# 301. 删除无效的括号 (Hard)
# https://leetcode-cn.com/problems/remove-invalid-parentheses/
"""
思路:
暴力:找出合法子序列的数量以及删除字符个数,再筛选删除字符个树最小的数量
暴力:先计算最少删除字符个数,然后找出长度为target的合法子序列,统计数量
暴力:
"""
class Solution:
# 长度较小,25以内,可以考虑暴力求解
def removeInvalidParentheses(self, s: str) -> Li... | 3.703125 | 4 |
CodeStomp/AmyCare/fit/migrations/0005_auto_20201123_1627.py | mayank712jindal/Code-Innovation-Series-ChitkaraUniversity | 0 | 12777945 | # Generated by Django 3.1.3 on 2020-11-23 10:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fit', '0004_auto_20201123_1625'),
]
operations = [
migrations.AlterField(
model_name='disease',
name='med1',
... | 1.515625 | 2 |
sgit/commit.py | russelldavis/SublimeGit | 310 | 12777946 | <gh_stars>100-1000
# coding: utf-8
from functools import partial
import sublime
from sublime_plugin import WindowCommand, TextCommand, EventListener
from .util import find_view_by_settings, noop, get_setting
from .cmd import GitCmd
from .helpers import GitStatusHelper
from .status import GIT_WORKING_DIR_CLEAN
GIT_C... | 2.296875 | 2 |
oled_ip.py | zlite/OLED_IP | 0 | 12777947 | # For use with I2C OLED screens.
# This requires the Adafruit Circuit Python OLED library, which superceeds earlier Adafruit OLED libraries
# Install it with `pip install adafruit-circuitpython-ssd1306`
import time
from subprocess import check_output
from board import SCL, SDA
import busio
from PIL import Image, Ima... | 2.859375 | 3 |
goodadmin/migrations/0004_stockpick_stockcode.py | waynezh86/tango_with_django_project | 0 | 12777948 | <reponame>waynezh86/tango_with_django_project
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2018-05-28 03:26
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('goodadmin', '0003_auto_20180525_2115'),
]
... | 1.414063 | 1 |
scripts/plot_conv.py | wordsworthgroup/libode | 11 | 12777949 | import numpy as np
import matplotlib.pyplot as plt
#plt.rc('font', family='serif')
#plt.rc('text', usetex=True)
sol1err = np.fromfile('../out/sol1err')
sol2err = np.fromfile('../out/sol2err')
L2err = np.sqrt(sol2err**2 + sol1err**2)
h = np.fromfile('../out/h')
x = np.sort(h)
fig, ax = plt.subplots(1,1)
for i in ran... | 2.625 | 3 |
task1/task.py | garncarz/prague-transport-2017 | 0 | 12777950 | <filename>task1/task.py
import re
import subprocess
from main import cache, celery
def dict_to_stdin(d):
s = '%d\n' % d['citiesCount']
for offer in d['costOffers']:
s += '%d %d %d\n' % (offer['from'], offer['to'], offer['price'])
return s.encode()
def stdout_to_dict(b):
d = {}
m = re.sp... | 2.78125 | 3 |