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 |
|---|---|---|---|---|---|---|
blog/migrations/0005_auto_20201008_1805.py | JiajiaHuang/smonus | 0 | 12791751 | # Generated by Django 2.2.1 on 2020-10-08 10:05
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('blog', '0004_auto_20201003_2247'),
]
operations = [
migrations.AddField(
model_name='channel',
... | 1.710938 | 2 |
pyop3/obj/parloop.py | wence-/pyop3 | 0 | 12791752 | from pyop3.api import AccessMode, ArgType, IterationRegion
from pyop3.codegen.compiled import build_wrapper, get_c_function
from pyop3.obj.kernel import Kernel
from pyop3.obj.maps import IdentityMap
from pyop3.obj.sets import AbstractSet
from pyop3.utils import cached_property, debug_check_args
def filter_args(args, ... | 1.90625 | 2 |
otdet/evaluation.py | kemskems/otdet | 1 | 12791753 | <filename>otdet/evaluation.py
"""
Out-of-topic post detection evaluation methods.
"""
from collections import Counter
import numpy as np
from scipy.stats import hypergeom
from otdet.util import lazyproperty
class TopListEvaluator:
"""Evaluate performance of OOT detector based on ranked result list."""
def... | 2.609375 | 3 |
mosqito/utils/isoclose.py | wantysal/MoSQITooo | 1 | 12791754 | <gh_stars>1-10
# -*- coding: utf-8 -*-
try:
import matplotlib.pyplot as plt
except ImportError:
raise RuntimeError(
"In order to perform this validation you need the 'matplotlib' package."
)
import numpy as np
def isoclose(actual, desired, rtol=1e-7, atol=0, is_plot=False, tol_label=None, xaxis=... | 2.75 | 3 |
Machine learning/ML/supervised_ML_Deep_learning/AI2_CNN.py | warpalatino/public | 1 | 12791755 | <reponame>warpalatino/public
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
from tensorflow.keras.preprocessing import image
from tensorflow.keras.preprocessing.image import ImageDataGenerator
# -------... | 3.0625 | 3 |
python/game/cui/dicegame.py | rrbb014/rrbb-playground | 0 | 12791756 | <reponame>rrbb014/rrbb-playground<gh_stars>0
import random
middle_dot = chr(0xb7) # U+00B7 -> 16 * 11 + 7 -> 183
player_position = 1
computer_position = 1
def board():
print(middle_dot*(player_position - 1) +
"P" +
middle_dot * (30 - player_position) + "GOAL"
)
print(middle_do... | 3.78125 | 4 |
discord/ext/test/websocket.py | Sillocan/dpytest | 4 | 12791757 |
import discord.gateway as gateway
from . import callbacks
class FakeWebSocket(gateway.DiscordWebSocket):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.cur_event = ""
self.event_args = ()
self.event_kwargs = {}
async def send(self, data):
... | 2.265625 | 2 |
src/sensai/data_transformation/dft.py | schroedk/sensAI | 0 | 12791758 | <reponame>schroedk/sensAI<gh_stars>0
import copy
import logging
import re
from abc import ABC, abstractmethod
from typing import List, Sequence, Union, Dict, Callable, Any, Optional, Set
import numpy as np
import pandas as pd
from sklearn.preprocessing import OneHotEncoder
from .sklearn_transformer import SkLearnTran... | 2.359375 | 2 |
external_test.py | YannisLawrence1/Covid-Alarm | 0 | 12791759 | <reponame>YannisLawrence1/Covid-Alarm<gh_stars>0
"""checks that all external files used in the clock programme are working as intended and includes
some suggestions for if some modules are not working"""
import json
from api_information import gather_news, news_anaysis, gather_weather, weather_analysis
from api_inf... | 2.578125 | 3 |
bob/learn/tensorflow/data/tfrecords.py | bioidiap/bob.learn.tensorflow | 2 | 12791760 | """Utilities for TFRecords
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import tensorflow as tf
TFRECORDS_EXT = ".tfrecords"
def tfrecord_name_and_json_name(output):
output = normalize_tfrecords_path(output)
json_output = outpu... | 2.84375 | 3 |
ebay_accounts/__init__.py | luke-dixon/django-ebay-accounts | 4 | 12791761 | <filename>ebay_accounts/__init__.py
# -*- coding: utf-8 -*-
default_app_config = 'ebay_accounts.apps.EbayAccountsConfig'
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 fileencoding=utf-8
| 1.179688 | 1 |
gen2-pipeline-analyser/analyse.py | ibaiGorordo/depthai-experiments | 1 | 12791762 | <reponame>ibaiGorordo/depthai-experiments
import argparse
import json
from pathlib import Path
parser = argparse.ArgumentParser()
parser.add_argument('file', metavar="FILE", type=Path, help="Path to pipeline JSON representation file to be used for analysis")
args = parser.parse_args()
if __name__ == "__main__":
i... | 2.796875 | 3 |
app/forms.py | lawrluor/matchstats | 6 | 12791763 | <filename>app/forms.py
from flask.ext.wtf import Form, validators
from wtforms import StringField, BooleanField, TextAreaField, SelectField, IntegerField, SelectMultipleField
from wtforms.validators import DataRequired, InputRequired, Required, ValidationError, StopValidation
from app import app, db
from app.models im... | 2.34375 | 2 |
skchainer/linear.py | lucidfrontier45/scikit-chainer | 27 | 12791764 | <filename>skchainer/linear.py
__author__ = 'du'
from chainer import Chain, functions as F
from . import ChainerRegresser, ChainerClassifier
class LinearRegression(ChainerRegresser):
def _setup_network(self, **params):
return Chain(l1=F.Linear(params["n_dim"], 1))
def _forward(self, x, train=False):
... | 2.703125 | 3 |
src/seed_words_wdg.py | frosted97/dash-masternode-tool | 75 | 12791765 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Author: Bertrand256
# Created on: 2021-04
from typing import Optional, List
from PyQt5 import QtCore, QtWidgets, QtGui
from PyQt5.QtCore import QVariant, QAbstractTableModel, pyqtSlot, QPoint, QTimer, Qt
from PyQt5.QtGui import QKeySequence
from PyQt5.QtWidgets import ... | 2.234375 | 2 |
qingmi/utils/functional.py | xiongxianzhu/qingmi | 20 | 12791766 | class Promise:
"""
Base class for the proxy class created in the closure of the lazy function.
It's used to recognize promises in code.
"""
pass
| 1.226563 | 1 |
toolkit/ev3/simulation/block/block.py | AlexGustafsson/ev3-emulator-toolkit | 0 | 12791767 | from typing import TypedDict, Optional, Dict
from dataclasses import dataclass
@dataclass
class BlockVariableDefinition():
type: str
id: str
name: str
@dataclass
class BlockField():
name: str
id: Optional[str]
variable_type: Optional[str]
value: str
@dataclass
class BlockShadow():
typ... | 3.125 | 3 |
python_back_end/triangle_formatting/sub_triangler.py | Henler/ReBridge_data_cloud | 0 | 12791768 | <gh_stars>0
from difflib import SequenceMatcher
from string import digits
from copy import deepcopy
import numpy as np
import pandas as pd
from scipy.sparse.csgraph._traversal import connected_components
from python_back_end.utilities.help_functions import general_adjacent
from python_back_end.data_cleaning.date_col_id... | 2.265625 | 2 |
Home-and-Elementary/between_markers.py | RiquePM/pyCheckiO-my_solutions | 0 | 12791769 | #--------------------------------------------#
# My Solution #
#--------------------------------------------#
def between_markers(text: str, begin: str, end: str):
if begin in text and end in text:
if text.find(begin)>text.find(end):
return ""
else:
return text[text.fi... | 3.4375 | 3 |
src/meanings/entityAnalysis.py | jordanjoewatson/natural-language-classifier | 1 | 12791770 | #!/usr/local/bin/python
import spacy
nlp = spacy.load('en')
entityLs = ["ORG","PERSON","DATE","TIME","MONEY","PERCENT","FAC","GPE","NORP","WORK_OF_ART","QUANTITY","LOC","PRODUCT","EVENT","LAW","LANGUAGE","ORDINAL","CARDINAL"]
def updateAlphaLs(text):
alphaLs = []
doc = nlp(text)
for token in doc:
if(token... | 2.78125 | 3 |
trello/space_works/migrations/0001_initial.py | copydataai/clon-trello | 0 | 12791771 | <filename>trello/space_works/migrations/0001_initial.py
# Generated by Django 3.2.13 on 2022-05-22 00:16
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
('us... | 1.828125 | 2 |
CISSL_cls/lib/algs/mean_teacher.py | MinsungHyun/Class-Imbalanced-Semi-Supervsied-Learning | 4 | 12791772 | import torch
import torch.nn as nn
import torch.nn.functional as F
import copy
class MT(nn.Module):
def __init__(self, model, ema_factor, loss='mse', scl_weight=None):
super().__init__()
self.model = model
self.model.train()
self.ema_factor = ema_factor
self.global_step = 0... | 2.34375 | 2 |
ini2.py | lmartinho/rosalind-solutions | 0 | 12791773 | <filename>ini2.py<gh_stars>0
a=807
b=905
#a=3
#b=5
c=a*a+b*b
print(c)
| 1.5625 | 2 |
recreate/common/myfolder.py | majo48/recreate-git | 0 | 12791774 | <reponame>majo48/recreate-git<gh_stars>0
""" Class MyFolder:
set file datetime created to metadata.creation_time in all files in folder
Copyright (c) 2021 <NAME> (<EMAIL>)
"""
import io
import sys
import os
from recreate.common import myfile
class MyFolder:
""" Recursive part of the recreate application "... | 2.953125 | 3 |
blog/migrations/0002_summary.py | maweefeng/Blog-Powed-by-Django | 1 | 12791775 | # Generated by Django 2.0 on 2019-05-21 06:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Summary',
fields=[
('summary_id', models.AutoField(prima... | 1.734375 | 2 |
CondTools/RPC/test/riovtest_cfg.py | nistefan/cmssw | 0 | 12791776 | <filename>CondTools/RPC/test/riovtest_cfg.py
import FWCore.ParameterSet.Config as cms
process = cms.Process("Demo")
process.load("CondCore.DBCommon.CondDBCommon_cfi")
process.load("FWCore.MessageService.MessageLogger_cfi")
process.CondDBCommon.connect = 'sqlite_file:/afs/cern.ch/user/d/dpagano/public/dati.db'
process... | 1.515625 | 2 |
data/backup/remove_punc_from_squad.py | ghundal93/QA-Experiments-with-DMN | 0 | 12791777 | import os
import string
import sys
mode = sys.argv[1]
output = open("punc_removed_"+str(mode)+".txt","w")
for i,line in enumerate(open("cleaned_squad_"+str(mode)+".txt")):
if "?" in line:
idx = line.find('?')
tmp = line[idx+1:].split('\t')
q = line[:idx+1]
a = tmp[1].strip()
... | 2.671875 | 3 |
docs_translate/reserved_word.py | gs-kikim/md_docs-trans-app | 0 | 12791778 | <filename>docs_translate/reserved_word.py<gh_stars>0
from pathlib import Path
import json
import re
class ReservedWords:
def __init__(self, path: Path):
with open(path, encoding='UTF8') as json_file:
json_data = json.load(json_file)
self.data = json_data
self.keys = list(self.d... | 3.203125 | 3 |
3.Object_oriented_programming/1.into.py | jkuatdsc/Python101 | 2 | 12791779 | <reponame>jkuatdsc/Python101
"""
Object oriented programing allow programs to imitate the objects in the real world
"""
"""
Create a student dict with name and grades and write a function to calculate the average grade of the student
"""
def main():
student = {
'name': '<NAME>',
'grades': [90, 1... | 4.21875 | 4 |
recognition/predict.py | w-garcia/insightface | 108 | 12791780 | <reponame>w-garcia/insightface
from __future__ import absolute_import, division, print_function, unicode_literals
import argparse
import os
import sys
import tensorflow as tf
import yaml
from recognition.backbones.resnet_v1 import ResNet_v1_50
from recognition.models.models import MyModel
tf.enable_eager_execution(... | 1.9375 | 2 |
Lib/test/test_compiler/testcorpus/04_assign.py | diogommartins/cinder | 1,886 | 12791781 | a = 1
b = "foo"
c = (d, e)
di = {f: 1, g: 2}
| 1.453125 | 1 |
LeetCode/217 Contains Duplicate.py | gesuwen/Algorithms | 0 | 12791782 | # Array; Hash Table
# Given an array of integers, find if the array contains any duplicates.
#
# Your function should return true if any value appears at least twice in the array, and it should return false if every element is distinct.
#
# Example 1:
#
# Input: [1,2,3,1]
# Output: true
# Example 2:
#
# Input: [1,2,3,... | 3.953125 | 4 |
solutions/python3/433.py | sm2774us/amazon_interview_prep_2021 | 42 | 12791783 | class Solution:
def minMutation(self, start: str, end: str, bank: List[str]) -> int:
bfs = [start]
genes = set(bank)
cnt = 0
while bfs:
arr = []
for g in bfs:
if g == end:
return cnt
for i, c in enumerate(g):... | 3.015625 | 3 |
migrations/versions/4c087f9202a_.py | mattkantor/basic-flask-app | 0 | 12791784 | <filename>migrations/versions/4c087f9202a_.py
"""empty message
Revision ID: 4c087f9202a
Revises: <PASSWORD>
Create Date: 2018-08-02 07:30:03.072213
"""
# revision identifiers, used by Alembic.
from sqlalchemy import Integer, String
revision = '4c087f9202a'
down_revision = '<PASSWORD>'
from alembic import op
import... | 1.726563 | 2 |
flex/http/cors.py | centergy/flex | 0 | 12791785 | <gh_stars>0
from flask_cors import CORS
from flex.conf import config
cors = CORS(origins=config.CORS_ORIGINS, supports_credentials=True) | 1.351563 | 1 |
{{cookiecutter.project_slug}}/apps/cms/presets.py | ukwahlula/django-server-boilerplate | 2 | 12791786 | # flake8: noqa
# fmt: off
from .choices import ContentType
CONTENT_PRESETS= {
# Emails
ContentType.EMAIL_VERIFICATION_SUBJECT: {
"content": "Verify your email.",
},
ContentType.EMAIL_VERIFICATION_BODY: {
"content": "Your verification code is {email_verification_code}.",
},
Conte... | 1.570313 | 2 |
src/dissertation/printInterpolationBarCharts.py | dhruvtapasvi/implementation | 1 | 12791787 | import numpy as np
import matplotlib.pyplot as plt
from evaluation.results import packageResults
from dissertation import datasetInfo
from config.routes import getRecordedResultsRoute
MINI_FONTSIZE=10
FONTSIZE = 14 * 4 / 3
NUMBER_FORMAT = "{:.0f}"
interpolationResults = packageResults.interpolationResults.getDict... | 2.5 | 2 |
esim/modules/exceptions.py | PunchyArchy/esim | 0 | 12791788 | """ Исключения """
class NoAsuPolygon(Exception):
# Исключение, возникающее при указании полигона, которого нет в АСУ.
def __init__(self):
text = 'Не найдена запись в таблице asu_poligons, соответствующая ' \
'этому полигону. Зарегестрируйте ее сначала.'
super().__init__(text)
| 2.890625 | 3 |
images/spark/outbound-relay/status_server.py | splunk/deep-learning-toolkit | 11 | 12791789 | <filename>images/spark/outbound-relay/status_server.py
from waitress import serve
from flask import Flask, request
import threading
import http
class StatusServer(object):
def __init__(self):
self.source_done = threading.Event()
self.source_error_event = threading.Event()
self._source_err... | 2.4375 | 2 |
solutions/121-BestTimeToBuy&SellStock.py | Reyansh14/leetcode-solutions | 0 | 12791790 | <gh_stars>0
# Notes: example of Sliding Window algorithm - keeps track of left and right pointers. iterate through prices array, keep track of left pointer called currMin. if currProfit > maxProfit, set maxProfit = currProfit. if the right pointer (prices[i]) < left pointer (currMin), set currMin to the right pointer a... | 3.84375 | 4 |
orange3/Orange/preprocess/normalize.py | rgschmitz1/BioDepot-workflow-builder | 54 | 12791791 | <reponame>rgschmitz1/BioDepot-workflow-builder
from Orange.data import ContinuousVariable, Domain
from Orange.statistics import distribution
from Orange.util import Reprable
from .preprocess import Normalize
from .transformation import Normalizer as Norm
__all__ = ["Normalizer"]
class Normalizer(Reprable):
def _... | 2.484375 | 2 |
setup.py | Mumbleskates/jsane | 131 | 12791792 | <filename>setup.py
#!/usr/bin/env python
import sys
from jsane import __version__
assert sys.version >= '2.7', ("Requires Python v2.7 or above, get with the "
"times, grandpa.")
from setuptools import setup
classifiers = [
"License :: OSI Approved :: MIT License",
"Programming La... | 1.484375 | 1 |
src/cryptoadvance/specter/services/swan/config.py | Lobbelt/specter-desktop | 0 | 12791793 | <reponame>Lobbelt/specter-desktop
"""
Swan API uses PKCE OAuth2. Per Swan's API team: The client secret here is not considered
to be a real secret. There is no reasonable attack vector for this secret being public.
"""
class BaseConfig:
SWAN_CLIENT_ID = "specter-dev"
SWAN_CLIENT_SECRET = (
"<KEY>"
... | 1.320313 | 1 |
tests_ui/helpers/db_actions.py | LoshmanovNA/pet-project | 1 | 12791794 | <filename>tests_ui/helpers/db_actions.py
from datetime import datetime
import time
class DBManager:
"""Установка соединения с БД и методы для выполнения запросов"""
def __init__(self, DBModel):
"""
Gets database information from mysql_conf.py and creates a connection.
"""
impo... | 2.609375 | 3 |
ch8/ex8.4.py | YChanHuang/Python-for-every-body-notes | 0 | 12791795 | <reponame>YChanHuang/Python-for-every-body-notes<filename>ch8/ex8.4.py
#solution 1
fname = input("Enter file name: ")
fh = open(fname)
lst = list()
for line in fh:
words = line.split()
for word in words:
if word in lst:
continue
else:
lst.append(word)
lst.sort()
print(lst)
#solution 2
fname = input("Enter ... | 3.765625 | 4 |
src/models/event_model.py | RoaringForkTech/rfv-events | 0 | 12791796 | import json
from dataclasses import dataclass
from typing import Optional
@dataclass()
class Event:
source: str # One of constants.EVENT_SOURCE
source_id: str # Unique ID from the source
name: str
_start_time: str = None
_end_time = None
_description = None
# {'timezone': 'America/Denv... | 3.015625 | 3 |
docs/conf.py | jbcurtin/cloud-fits | 3 | 12791797 | <reponame>jbcurtin/cloud-fits
# Configuration file for the Sphinx documentation builder.
# https://www.sphinx-doc.org/en/master/usage/configuration.html
project = 'Cloud Optimized Fits'
copyright = '2020, <NAME>'
author = '<NAME>'
# The full version, including alpha/beta/rc tags
with open('../VERSION', 'r') as stream:
... | 1.28125 | 1 |
code/tmp_rtrip/test/curses_tests.py | emilyemorehouse/ast-and-me | 24 | 12791798 | import curses
from curses import textpad
def test_textpad(stdscr, insert_mode=False):
ncols, nlines = 8, 3
uly, ulx = 3, 2
if insert_mode:
mode = 'insert mode'
else:
mode = 'overwrite mode'
stdscr.addstr(uly - 3, ulx, 'Use Ctrl-G to end editing (%s).' % mode)
stdscr.addstr(uly ... | 3.484375 | 3 |
least_squares/warm_up/qudratic_regression.py | yimuw/yimu-blog | 8 | 12791799 | <gh_stars>1-10
import numpy as np
import matplotlib.pyplot as plt
def generate_quadratic_data():
quadratic_a = 2.4
quadratic_b = -2.
quadratic_c = 1.
num_data = 30
noise = 2 * np.random.randn(num_data)
sampled_x = np.linspace(-10, 10., num_data)
sampled_y = quadratic_a * sampled_x * sam... | 3 | 3 |
swagger/action-server/rlbot_action_server/models/bot_action.py | tarehart/RLBotTwitchBroker | 2 | 12791800 | <reponame>tarehart/RLBotTwitchBroker<gh_stars>1-10
# coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from rlbot_action_server.models.base_model_ import Model
from rlbot_action_server.models.strategic_category import St... | 1.914063 | 2 |
am4894pd/utils.py | andrewm4894/am4894pd | 0 | 12791801 | import pandas as pd
import numpy as np
def df_info(df: pd.DataFrame, return_info=False, shape=True, cols=True, info_prefix=''):
""" Print a string to describe a df.
"""
info = info_prefix
if shape:
info = f'{info}Shape = {df.shape}'
if cols:
info = f'{info} , Cols = {df.columns.tol... | 3.015625 | 3 |
heritago/heritages/views.py | SWE574-Groupago/heritago | 6 | 12791802 | from django.core.exceptions import ObjectDoesNotExist
from django.core.files.uploadedfile import UploadedFile
from django.conf import settings
from django.http import HttpResponse
from rest_framework import generics
from rest_framework.exceptions import NotFound
from rest_framework.response import Response
from rest_fr... | 1.90625 | 2 |
05-Inheritance/problem-5-Restaurant/project/beverage/hot_beverage.py | Beshkov/OOP | 1 | 12791803 | from project.beverage.beverage import Beverage
class HotBeverage(Beverage):
pass | 1 | 1 |
Transposicion/TransposicionSerie.py | pordnajela/AlgoritmosCriptografiaClasica | 0 | 12791804 | <reponame>pordnajela/AlgoritmosCriptografiaClasica
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
class TransposicionSerie(object):
def __init__(self, series, cadena=None):
self.cadena = cadena
self.series = series
self.textoClaro = ""
self.textoCifrado = ""
def cifrar(self):
textoCifrado = ""
linea_a_c... | 3.0625 | 3 |
preprocessing/utils.py | clitic/signauth | 1 | 12791805 | import glob
import cv2
import numpy as np
def globimgs(path, globs:list):
"""returns a list of files with path with globing with more than one extensions"""
imgs = []
for i in globs:
imgs.extend(glob.glob(path + i))
paths = []
for path in imgs:
paths.append(path.replace("\\", "/"))
return paths
def scan... | 2.953125 | 3 |
tests/unittests/test_folder.py | ZPascal/grafana_api_sdk | 2 | 12791806 | <filename>tests/unittests/test_folder.py
from unittest import TestCase
from unittest.mock import MagicMock, Mock, patch
from src.grafana_api.model import APIModel
from src.grafana_api.folder import Folder
class FolderTestCase(TestCase):
@patch("src.grafana_api.api.Api.call_the_api")
def test_get_folders(self... | 2.5625 | 3 |
testing/playground/esp8266_communication.py | dpm76/Microvacbot | 1 | 12791807 | '''
Created on 31 mar. 2020
@author: David
'''
from sys import path
path.append("/flash/userapp")
from pyb import LED, Switch, Pin
from uasyncio import get_event_loop, sleep_ms as ua_sleep_ms
from uvacbot.io.esp8266 import Connection, Esp8266
class LedToggleConnection(Connection):
async def onConnected(sel... | 2.75 | 3 |
src/Data/__init__.py | ArmanZarrin/Telegram--Stat | 0 | 12791808 | from pathlib import Path
DATA_DIR= Path(__file__).resolve().parent | 1.398438 | 1 |
tests/rate_limit_test.py | maruthiprithivi/tweetf0rm | 1 | 12791809 | <gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.DEBUG, format='%(levelname)s: %(message)s')
requests_log = logging.getLogger("requests")
requests_log.setLevel(logging.DEBUG)
from nose.tools import nottest
import sys,... | 1.960938 | 2 |
organizing_hub/templatetags/organizing_hub_tags.py | JoshZero87/site | 4 | 12791810 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django import template
from django.conf import settings
from django.urls import reverse_lazy
from calls.models import CallCampaignStatus
from local_groups.models import find_local_group_by_user
from organizing_hub.models import OrganizingHubLoginAlert... | 1.898438 | 2 |
tests/fits2png_zoom.py | nbarbey/csh | 1 | 12791811 | #!/usr/bin/env python
import getopt, sys, os
import numpy as np
import pyfits
from pylab import matplotlib
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid.inset_locator import zoomed_inset_axes
from mpl_toolkits.axes_grid.inset_locator import mark_inset
#fname_ext = '/home/nbarbey/data/csh/output/ngc6946_c... | 2.171875 | 2 |
rlcard/games/tienlen/utils.py | xiviu123/rlcard | 0 | 12791812 | <gh_stars>0
import math
from typing import List
import threading
import collections
import itertools
import numpy as np
import operator as op
from functools import reduce
def nPr(n, r):
return math.factorial(n)/(math.factorial(n-r))
def nCr(n, r):
r = min(r, n-r)
numer = reduce(op.mul, range(n, n-r, -1), ... | 3.015625 | 3 |
vultr/v1_block.py | kchoudhu/python-vultr | 2 | 12791813 | <gh_stars>1-10
'''Partial class to handle Vultr Account API calls'''
from .utils import VultrBase, update_params
class VultrBlockStore(VultrBase):
'''Handles Vultr Account API calls'''
def __init__(self, api_key):
VultrBase.__init__(self, api_key)
def attach(self, subid, attach_to_subid, params=No... | 2.40625 | 2 |
sta/client.py | NMWDI/PySTA | 1 | 12791814 | <filename>sta/client.py
# ===============================================================================
# Copyright 2021 ross
#
# 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.... | 2.171875 | 2 |
assignment8/mapper.py | IITDU-BSSE06/ads-demystifying-the-logs-KhairulAlam-IITDU | 0 | 12791815 | #!/usr/bin/python
import sys
for line in sys.stdin:
row = line.strip().split(" ")
if len(row) == 10
File = str(row[6])
t1 = File.strip().split(".")
ind = len(t1)-1
t2 = str(t1[ind])
print t2
| 2.765625 | 3 |
Headedness/Transitive/Test_Trans.py | mlepori1/Picking_BERTs_Brain | 5 | 12791816 | <reponame>mlepori1/Picking_BERTs_Brain
import torch
from pytorch_pretrained_bert import BertTokenizer, BertModel
import logging
import matplotlib.pyplot as plt
import sys
import numpy as np
sys.path.append("../..")
import RSA_utils.utils as RSA
import glove_utils.utils as utils
from statsmodels.stats.descriptivestats i... | 2.421875 | 2 |
tests/conftest.py | alexanderrichards/ProductionSystem | 0 | 12791817 | <filename>tests/conftest.py
"""Define necessary setup fixtures."""
import pytest
import pkg_resources
from productionsystem.config import ConfigSystem
@pytest.fixture(scope="session", autouse=True)
def config():
"""Set up the config entrypoint map."""
config_instance = ConfigSystem.setup(None) # pylint: disa... | 2.15625 | 2 |
universalwrapper/__init__.py | Basdbruijne/UniversalWrapper | 4 | 12791818 | import sys
import universalwrapper.universal_wrapper as universalwrapper
sys.modules[__name__] = universalwrapper
| 1.21875 | 1 |
index/utils/webuserinfo.py | importer/widen | 0 | 12791819 | # coding=utf-8
import logging
from widen import settings
import requests
from index.models import *
class WeiXinLogin():
def __init__(self, code, state):
self.code = code
self.state = state
self.appid = settings.APP_ID
self.appsecret = settings.APP_SECRET
self.access_token ... | 2.140625 | 2 |
tests/test_datamodel.py | qinfeng2011/wltp | 0 | 12791820 | <reponame>qinfeng2011/wltp
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2013-2019 European Commission (JRC);
# Licensed under the EUPL (the 'Licence');
# You may not use this work except in compliance with the Licence.
# You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl
import sys
... | 1.90625 | 2 |
postfix_expression.py | GoddessLuBoYan/postfix-expression | 0 | 12791821 | """
作者(github账号):GoddessLuBoYan
内容:将四则运算的中缀表达式转换成后缀表达式并计算
要求:每个数字必须都是一位数,我没有考虑多位数和小数的情况
"""
# 基本容器定义
class Container:
def __init__(self, iterator=None):
self._list = []
if iterator:
for i in iterator:
self.push(i)
def __len__(self):
... | 4.21875 | 4 |
test_nagplug.py | aslafy-z/nagplug | 3 | 12791822 | import unittest
from nagplug import Plugin, Threshold, ArgumentParserError
from nagplug import OK, WARNING, CRITICAL, UNKNOWN
class TestParsing(unittest.TestCase):
def test_parse(self):
plugin = Plugin()
plugin.add_arg('-e', '--test', action='store_true')
args = plugin.parser.parse_args([... | 2.703125 | 3 |
get-xkcd.py | zimolzak/get-xkcd | 0 | 12791823 | <reponame>zimolzak/get-xkcd
import json
import urllib.request
import ssl
from sys import argv
unverified = ssl._create_unverified_context()
start = 614
end = 617
# last comic with a reliable transcript is roughly 1608?
# Last with any might be 1677.
# But 1677 really contains transcript from 1674.
# someone noticed ... | 3.015625 | 3 |
paypal_transactions_wrapper/transaction.py | Ori-Roza/paypal_transactions_wrapper | 0 | 12791824 | from paypal_transactions_wrapper.exceptions import TransactionPropertyNotFound
class Transaction:
KEY_MAP = {
"TIMESTAMP": "date",
"TIMEZONE": "timezone",
"TYPE": "type",
"EMAIL": "costumer_email",
"NAME": "costumer_name",
"TRANSACTIONID": "id",
"STATUS": "s... | 2.859375 | 3 |
cracking-the-coding-interview/ch9-recursion-and-dynamic-programming/9.5-permutations.py | joeghodsi/interview-questions | 1 | 12791825 | <filename>cracking-the-coding-interview/ch9-recursion-and-dynamic-programming/9.5-permutations.py
'''
Problem: Return all permutations of a given string
Solution: Iterate over the elements and lock the current elem in as the ith elem in a partial
permutation then recurse with the remaining values sans the ith eleme... | 4.15625 | 4 |
chapter_09/04_unique_words.py | SergeHall/Tony-Gaddis-Python-4th | 2 | 12791826 | <filename>chapter_09/04_unique_words.py
# unique words
# # 4. Уникальные слова. Напишите программу, которая открывает заданный
# текстовый файл (text_file_9.4.txt) и затем показывает список всех
# уникальных слов в файле. (Подсказка: храните слова в качестве элементов
# множества.)
def main():
my_str = "Welcome! A... | 4.25 | 4 |
src/peachyprinter/api/test_print_api.py | Createcafe3d/YXE3Dtools | 23 | 12791827 | <filename>src/peachyprinter/api/test_print_api.py<gh_stars>10-100
import inspect
from peachyprinter.domain.layer_generator import LayerGenerator
from peachyprinter.infrastructure import print_test_layer_generators
class TestPrintAPI(object):
'''Api used for getting test prints
Typical usage:
API = T... | 2.5 | 2 |
demo-spiral.py | rougier/JCGT-2014a | 5 | 12791828 | <filename>demo-spiral.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (C) 2013 <NAME>. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the... | 1.742188 | 2 |
mmdeploy/backend/sdk/__init__.py | aegis-rider/mmdeploy | 1 | 12791829 | <reponame>aegis-rider/mmdeploy
# Copyright (c) OpenMMLab. All rights reserved.
import importlib
import os
import sys
lib_dir = os.path.abspath(
os.path.join(os.path.dirname(__file__), '../../../build/lib'))
sys.path.insert(0, lib_dir)
_is_available = False
if importlib.util.find_spec('mmdeploy_python') is not N... | 1.84375 | 2 |
deliravision/torch/models/gans/context_conditional/__init__.py | delira-dev/vision_torch | 4 | 12791830 | <reponame>delira-dev/vision_torch<filename>deliravision/torch/models/gans/context_conditional/__init__.py
from deliravision.models.gans.context_conditional.context_cond_gan import \
ContextConditionalGAN
| 1.046875 | 1 |
prodj/core/prodj.py | beauburrows/python-prodj-link | 66 | 12791831 | import socket
import logging
from threading import Thread
from select import select
from enum import Enum
from prodj.core.clientlist import ClientList
from prodj.core.vcdj import Vcdj
from prodj.data.dataprovider import DataProvider
from prodj.network.nfsclient import NfsClient
from prodj.network.ip import guess_own_i... | 2.1875 | 2 |
ProtonBeamTherapy/macrotools.py | dmitryhits/ProtonBeamTherapy | 0 | 12791832 | <gh_stars>0
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/00_macrotools.ipynb (unless otherwise specified).
__all__ = ['MacroWriter', 'create_all', 'run_macro', 'Ek']
# Cell
import subprocess
from os import path
from time import strftime
class MacroWriter:
"""Main class for creating a macro file to be run by `... | 2.125 | 2 |
tests/test_read_requirements.py | benbenbang/Req2Toml | 10 | 12791833 | <reponame>benbenbang/Req2Toml<filename>tests/test_read_requirements.py
# standard library
from unittest import TestCase, expectedFailure
# req2toml plugin
from req2toml.utils import read_requirments
from tests.mixin import CaseMixin, TempfileMixin
class TestReadRequirmentsFormattedContent(CaseMixin, TempfileMixin, T... | 2.609375 | 3 |
grep/file_helper.py | florianbegusch/simple_grep | 0 | 12791834 | <reponame>florianbegusch/simple_grep
"""Supplies relevant files for grep.py."""
import os
import sys
def get_next_file(caller_dir, is_recursive):
"""Generates next file to be searched."""
assert type(caller_dir) is str
assert type(is_recursive) is bool
for root, dirs, files in os.walk(caller_dir):
... | 3.109375 | 3 |
patent_search.py | f--f/nano-patents | 0 | 12791835 | import requests
import bs4
import sqlite3
# Relevant API Documentation:
# USPTO: https://developer.uspto.gov/ibd-api-docs/
# Google Maps: https://developers.google.com/maps/documentation/geocoding/intro
USPTO_API = "https://developer.uspto.gov/ibd-api/v1/patent/application"
MAPS_API = "https://maps.googleapis.com/maps... | 2.96875 | 3 |
cryptoprice.py | Marto32/cryptoprice | 0 | 12791836 | #! /usr/bin/env python
import argparse
import datetime
import json
import time
import logging
import pandas as pd
import requests
from pathlib import Path
from retrying import retry
AVAILABLE_CURRENCY_PAIRS = ['BTC_AMP', 'BTC_ARDR', 'BTC_BCH', 'BTC_BCN', 'BTC_BCY', 'BTC_BELA',
'BTC_BLK', ... | 1.8125 | 2 |
second/pytorch/annotations_process.py | lpj0822/pointpillars_train | 1 | 12791837 | <reponame>lpj0822/pointpillars_train<filename>second/pytorch/annotations_process.py
import os
import sys
sys.path.insert(0, os.getcwd() + "/.")
import math
import numpy as np
import json
# import pcl
from second.pytorch.show_3dbox import mayavi_show_3dbox
def getFileData(dataFilePath):
with open(dataFilePath, 'r'... | 2.3125 | 2 |
python/ros_ws/src/recorder/nodes/relay.py | JonathanCamargo/Eris | 0 | 12791838 | #!/usr/bin/env python
# Relay node takes a list of topics and republish prepending /record namespace
import rospy
import rostopic
import signal
import sys
QUEUE_SIZE=1000 #Make sure we don't miss points
def signal_handler(sig,frame):
print('Ctrl+c')
sys.exit(0)
signal.signal(signal.SIGINT,signal_handler)
d... | 2.96875 | 3 |
humanreadable/_base.py | thombashi/humanreadable | 12 | 12791839 | """
.. codeauthor:: <NAME> <<EMAIL>>
"""
import abc
import re
from decimal import Decimal
from typepy import RealNumber, String
from .error import ParameterError, UnitNotFoundError
_BASE_ATTRS = ("name", "regexp")
_RE_NUMBER = re.compile(r"^[-\+]?[0-9\.]+$")
def _get_unit_msg(text_units):
return ", ".join(["... | 2.984375 | 3 |
photo/views_show.py | shagun30/djambala-2 | 0 | 12791840 | <filename>photo/views_show.py
# -*- coding: utf-8 -*-
"""
/dms/photo/views_show.py
.. zeigt den Inhalt eines Photos an
Django content Management System
<NAME>
<EMAIL>
Die Programme des dms-Systems koennen frei genutzt und den spezifischen
Beduerfnissen entsprechend angepasst werden.
0.01 29.10.2007 Begin... | 2.171875 | 2 |
animation_and_polting.py | SABS-R3-projects/PARA_PDE | 0 | 12791841 | import matplotlib.pyplot as plt
import time
from matplotlib import animation
def animate(U, timeSteps: int, postionSteps: int, timeStepSize: float):
fig= plt.figure()
ims = []
for i in range(timeSteps):
im = plt.plot(postionSteps, U[:,i] , animated = True, color = 'red')
ims.append(im... | 3.125 | 3 |
tests/TestPortfolio.py | patchan/potatofy | 2 | 12791842 | import unittest
from decimal import Decimal
from Broker import Broker
from Portfolio import Account, Portfolio
from tests.MockAuthenticator import MockAuthenticator, load_test_balance, \
load_test_positions
class TestPortfolio(unittest.TestCase):
def setUp(self):
self.broker = Broker()
self.... | 2.671875 | 3 |
tests/unit/baskerville_tests/models_tests/pipeline_task_tests/tests_task_base.py | deflect-ca/baskerville | 2 | 12791843 | <reponame>deflect-ca/baskerville<gh_stars>1-10
# Copyright (c) 2020, eQualit.ie inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from unittest import mock
from baskerville.models.config import BaskervilleConf... | 2.046875 | 2 |
src/BiGruSelfattention.py | keigotak/COVID19Tweet | 0 | 12791844 | <gh_stars>0
import torch
import torch.nn as nn
from AbstractModel import AbstractModel
from Attention import Attention
class BiGruSelfattention(AbstractModel):
def __init__(self, device='cpu', hyper_params=None):
sup = super()
sup.__init__(device=device, hyper_params=hyper_params)
self.em... | 2.296875 | 2 |
src/level/level.py | fish-face/agutaywusyg | 0 | 12791845 | <filename>src/level/level.py
# encoding=utf-8
### Levels define the terrain making up an area
TEST_LEVEL = (
"##########",
"#....#...#",
"#....#...#",
"#.####...#",
"#........#",
"#........#",
"##########")
class TerrainInfo:
def __init__(self, char, name, index, block_move, block_sig... | 3.125 | 3 |
online_doctor/prescription/admin.py | zawad2221/online-doctor-server | 0 | 12791846 | from django.contrib import admin
from .models import Medicine, MedicineForm, Suggestion, Instruction, Company, Prescription, PrescribedMedicine, PatientHistory
admin.site.register(Medicine)
admin.site.register(MedicineForm)
admin.site.register(Suggestion)
admin.site.register(Instruction)
admin.site.register(Company)
a... | 1.25 | 1 |
packages/testcases/input/nameprep/extract-tests.py | taarushv/ethers.js | 4,494 | 12791847 | import json
import re
output = ""
for line in file("test-vectors-00.txt"):
line = line.strip()
if line == "" or line[0:1] == "#":
continue
if line.startswith("Josefsson") or line.startswith("Internet-Draft"):
continue
output += line.replace("\n", "")
Tests = [ ]
def get_byte(v):
i... | 2.828125 | 3 |
log_analyzer.py | timvoet/log_parser | 1 | 12791848 | <reponame>timvoet/log_parser
#!/usr/bin/env python
from orm.model import LogEvent
import optparse
import time
import re
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
supported_DBS = ['sqlite3']
date_pattern = re.compile(r'(\d\d\d\d... | 2.3125 | 2 |
tests/unit/outputs/cli/ci/system/utils/sorting/test_jobs.py | rhos-infra/cibyl | 3 | 12791849 | """
# Copyright 2022 Red Hat
#
# 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 agr... | 3.4375 | 3 |
src/utils.py | aemccoy/GrayCode-QubitEncoding | 4 | 12791850 | <reponame>aemccoy/GrayCode-QubitEncoding
import numpy as np
from openfermion.ops import QubitOperator
from itertools import product
from functools import reduce
mats = {"I" : np.eye(2),
"X" : np.array(([[0, 1], [1, 0]])),
"Y" : np.array(([[0, -1j], [1j, 0]])),
"Z" : np.array(([[1, 0], [0, -1]]... | 3.296875 | 3 |