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 |
|---|---|---|---|---|---|---|
dlms_cosem/clients/experimental_meter.py | Layty/dlms-cosem | 1 | 34200 | <reponame>Layty/dlms-cosem<filename>dlms_cosem/clients/experimental_meter.py
from contextlib import contextmanager
from decimal import Decimal
from typing import *
import attr
from dlms_cosem import cosem, utils
from dlms_cosem.clients.dlms_client import DlmsClient
from dlms_cosem.cosem import Obis
from dlms_cosem.co... | 2.421875 | 2 |
inference/encoder_train_pipeline.py | kuzhamuratov/deep-landscape | 95 | 34201 | import copy
import datetime
import os
import random
import traceback
import numpy as np
import torch
from torch.utils.data import DataLoader
from torchvision.utils import save_image
from inference.inference_utils import get_trange, get_tqdm
def init_random_seed(value=0):
random.seed(value)
np.random.seed(va... | 2.171875 | 2 |
app/forms.py | paulpaulaga/ask-paul | 0 | 34202 | <filename>app/forms.py
from django import forms
from app.models import Question, Profile, Answer
from django.contrib.auth.models import User
class LoginForm(forms.Form):
username = forms.CharField()
password = forms.CharField(widget=forms.PasswordInput)
def __init__(self, *args, **kwargs):
super(... | 2.515625 | 3 |
python/cc_emergency/functional/transforms/language_filter.py | DavidNemeskey/cc_emergency_corpus | 0 | 34203 | <filename>python/cc_emergency/functional/transforms/language_filter.py
#!/usr/bin/env python3
# vim: set fileencoding=utf-8 :
"""Language / domain filtering transforms."""
from functools import partial
import importlib
import inspect
import tldextract
from cc_emergency.functional.core import Filter
from cc_emergenc... | 2.328125 | 2 |
mathgenerator/funcs/volumeSphereFunc.py | furins/mathgenerator | 0 | 34204 | from .__init__ import *
def volumeSphereFunc(maxRadius = 100):
r=random.randint(1,maxRadius)
problem=f"Volume of sphere with radius {r} m = "
ans=(4*math.pi/3)*r*r*r
solution = f"{ans} m^3"
return problem,solution
| 2.828125 | 3 |
create_widget.py | Adam01/Cylinder | 4 | 34205 | import os
import sys
import shutil
templateDir = "./Cylinder/WidgetTemplate"
widgetOutDir = "./Cylinder/rapyd/Widgets/"
if len(sys.argv) > 1:
name = sys.argv[1]
widgetDir = os.path.join(widgetOutDir, name)
if not os.path.exists(widgetDir):
if os.path.exists(templateDir):
os.mkdir(widg... | 2.875 | 3 |
examples/06-worker.py | pacslab/serverless-performance-simulator | 5 | 34206 | import zmq
import time
import sys
import struct
import multiprocessing
from examples.sim_trace import generate_trace
port = "5556"
if len(sys.argv) > 1:
port = sys.argv[1]
int(port)
socket_addr = "tcp://127.0.0.1:%s" % port
worker_count = multiprocessing.cpu_count() * 2 + 1
stop_signal = False
def worker(c... | 2.609375 | 3 |
ensembl_genes/species.py | ravwojdyla/ensembl-genes | 5 | 34207 | <reponame>ravwojdyla/ensembl-genes
from dataclasses import dataclass
from typing import Optional, Union
from ensembl_genes.models import GeneForMHC
@dataclass
class Species:
name: str
common_name: str
assembly: str
ensembl_gene_pattern: str
enable_mhc: bool
mhc_chromosome: str
mhc_lower: ... | 2.984375 | 3 |
app_covid19data/tests/test_views.py | falken20/covid19web | 0 | 34208 | from django.test import TestCase
from django.urls import reverse
from django.utils import timezone
from model_bakery import baker
from app_covid19data.models import DataCovid19Item
from app_covid19data import views
class Covid19dataTest(TestCase):
def setUp(self):
""" Method which the testing framework ... | 2.671875 | 3 |
Chapter05/restful_python_2_05/Django01/games_service/games/models.py | PacktPublishing/Hands-On-RESTful-Python-Web-Services-Second-Edition | 45 | 34209 | <filename>Chapter05/restful_python_2_05/Django01/games_service/games/models.py
from django.db import models
class Game(models.Model):
created_timestamp = models.DateTimeField(auto_now_add=True)
name = models.CharField(max_length=200)
release_date = models.DateTimeField()
esrb_rating = models.CharField... | 2.328125 | 2 |
old_py2/controllers/datafeed_controller.py | bovlb/the-blue-alliance | 0 | 34210 | <reponame>bovlb/the-blue-alliance<gh_stars>0
import logging
import os
import datetime
import tba_config
import time
import json
from google.appengine.api import taskqueue
from google.appengine.ext import ndb
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from consts.event_typ... | 1.765625 | 2 |
src/bot/handlers/essence_part_handler.py | nchursin/claimant | 3 | 34211 | from typing import Optional, List
from aiogram import types, Dispatcher, filters
from aiogram.dispatcher import FSMContext
from aiogram.dispatcher.filters.state import StatesGroup, State
from aiogram.types import ReplyKeyboardMarkup
from handlers.common_actions_handlers import process_manual_enter, process_option_sel... | 2.125 | 2 |
SCRWebService/message_handling/message_forwarder.py | tomzo/integration-adaptors | 0 | 34212 | """Module related to processing of an outbound message"""
from typing import Dict, Optional
from utilities import integration_adaptors_logger as log
from builder.pystache_message_builder import MessageGenerationError
from message_handling.message_sender import MessageSender
import xml.etree.ElementTree as ET
logger = ... | 2.34375 | 2 |
HackerRank/Alphabet Rangoli/solution.py | nikku1234/Code-Practise | 9 | 34213 | import string
def print_rangoli(size):
# your code goes here
'''
alphabets = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
symbol = '-'
array_size = size + 3*(size-1)
print(array_size)
for i in range(0,array_size):
for left_... | 3.90625 | 4 |
src/visualize/visualize_checkpoint.py | Immocat/ACTOR | 164 | 34214 | <reponame>Immocat/ACTOR
import os
import matplotlib.pyplot as plt
import torch
from src.utils.get_model_and_data import get_model_and_data
from src.parser.visualize import parser
from .visualize import viz_epoch
import src.utils.fixseed # noqa
plt.switch_backend('agg')
def main():
# parse options
paramete... | 2.234375 | 2 |
APIs/Biquery/src/infra/models/datasets.py | clarencejlee/jdp | 0 | 34215 | <reponame>clarencejlee/jdp
from enum import Enum
from tortoise import fields
from tortoise.models import Model
class Status(str, Enum):
PENDING = "pending"
IMPORTED = "imported"
class Datasets(Model):
id = fields.CharField(36, pk=True)
provider = fields.CharField(10, null=False)
provider_id = fie... | 2.609375 | 3 |
src/python/pipelines_utils/file_utils.py | InformaticsMatters/pipelines-utils | 0 | 34216 | #!/usr/bin/env python
# Copyright 2018 Informatics Matters Ltd.
#
# 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 applicab... | 2.5 | 2 |
devlin2/modular_square/rtl/gen_reduction_lut.py | supranational/-vdf-fpga-round3-results | 44 | 34217 | <filename>devlin2/modular_square/rtl/gen_reduction_lut.py<gh_stars>10-100
#!/usr/bin/python3
################################################################################
# Copyright 2019 Supranational LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in comp... | 1.757813 | 2 |
StinoStarter.py | geekroo/Stino | 1 | 34218 | <gh_stars>1-10
#-*- coding: utf-8 -*-
# StinoStarter.py
import os
import sublime
import sublime_plugin
st_version = int(sublime.version())
if st_version < 3000:
import app
else:
from . import app
class SketchListener(sublime_plugin.EventListener):
def on_activated(self, view):
pre_active_sketch = app.constant.g... | 1.96875 | 2 |
the-lambda-trilogy/python/src/lambdas/the_lambda_lith/lambda_function.py | InfrastructureHQ/CDK-Patterns | 0 | 34219 | def lambda_handler(event):
try:
first_num = event["queryStringParameters"]["firstNum"]
except KeyError:
first_num = 0
try:
second_num = event["queryStringParameters"]["secondNum"]
except KeyError:
second_num = 0
try:
operation_type = event["queryStringParame... | 2.875 | 3 |
dqo/relational/tests/test_augmentation.py | danield137/deep_query_optimzation | 0 | 34220 | <filename>dqo/relational/tests/test_augmentation.py
from dqo.db.tests.datasets import employees_db_w_meta
from dqo.relational import SQLParser
from dqo.relational import parse_tree
test_db = employees_db_w_meta()
def test_condition_permutation():
sql = """
SELECT MIN(employees.salary)
FROM emp... | 2.71875 | 3 |
src/newt/db/_ook.py | bmjjr/db | 153 | 34221 | import relstorage.storage
import ZODB.Connection
# Monkey patches, ook
def _ex_cursor(self, name=None):
if self._stale_error is not None:
raise self._stale_error
with self._lock:
self._before_load()
return self._load_conn.cursor(name)
relstorage.storage.RelStorage.ex_cursor = _ex_curs... | 2.359375 | 2 |
arimaModel.py | gehadnaser/fraud-detection_stockmarket | 0 | 34222 | import numpy as np, pandas as pd
import math
from statsmodels.tsa.arima_model import ARIMA
from statsmodels.tsa.stattools import adfuller, kpss, acf
import matplotlib.pyplot as plt
plt.rcParams.update({'figure.figsize': (9, 7), 'figure.dpi': 120})
# Import data
def Read(name):
df = pd.read_csv(name + ... | 2.609375 | 3 |
code/preprocess/data_process.py | hms-dbmi/VarPPUD | 0 | 34223 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 9 15:38:54 2020
@author: rayin
"""
# pic-sure api lib
import PicSureHpdsLib
import PicSureClient
# python_lib for pic-sure
# https://github.com/hms-dbmi/Access-to-Data-using-PIC-SURE-API/tree/master/NIH_Undiagnosed_Diseases_Network
from python_li... | 2.234375 | 2 |
scripts/energy.py | rinku-mishra/PPDyn | 2 | 34224 | #!/usr/bin/env python3
import numpy as np
import h5py
import matplotlib.pyplot as plt
# import plotly.graph_objects as go
#========= Configuration ===========
DIR ="../data"
file_name = "particle"#"rhoNeutral" #"P"
h5 = h5py.File('../data/'+file_name+'.hdf5','r')
Lx = h5.attrs["Lx"]
Ly = h5.attrs["Ly"]
Lz = h5.at... | 2.46875 | 2 |
webvulnscan/request.py | hhucn/webvulnscan | 40 | 34225 | import copy
import sys
from . import compat
from .compat import urlencode, parse_qs
class Request(compat.Request):
def __init__(self, url, parameters=None, headers=None):
self.parameters = parameters
if parameters is None:
data = None
else:
if sys.version_info >= (... | 2.578125 | 3 |
api/api.py | mshen63/DevUp | 2 | 34226 | <reponame>mshen63/DevUp
import os
from flask import Flask
from dotenv import load_dotenv
from flask_cors import CORS
from flask_mail import Mail
# Database and endpoints
from flask_migrate import Migrate
from models.models import db
from endpoints.exportEndpoints import exportEndpoints
load_dotenv()
app = Flask(__nam... | 2.125 | 2 |
core/run.py | mofengboy/Chain-of-all-beings | 2 | 34227 | <gh_stars>1-10
import getopt
import sys
import os
import logging.config
import time
import yaml
sys.path.append("../")
sys.path.append(os.path.abspath("."))
from core.app import APP
from core.utils.ciphersuites import CipherSuites
from core.utils.system_time import STime
from core.config.cycle_Info import ElectionPer... | 2.09375 | 2 |
main.py | josehenriqueroveda/spraying-API | 0 | 34228 | <reponame>josehenriqueroveda/spraying-API
from fastapi import FastAPI
from starlette.responses import RedirectResponse
from ratelimit import limits
import sys
import uvicorn
import requests
import json
import config
ONE_MINUTE = 60
app = FastAPI(title='Spraying conditions API',
description='API for real... | 3 | 3 |
task3_word2vec_lstm.py | tomelf/cnit-623 | 4 | 34229 | <gh_stars>1-10
import data_loader
import numpy as np
import pandas as pd
import pickle
import os
import nltk
import re
import timeit
from torch.autograd import Variable
import torch
from sklearn import preprocessing, svm
from sklearn.metrics import roc_auc_score, accuracy_score, classification_report
from sklearn.mod... | 2.1875 | 2 |
setup.py | trsav/romodel | 27 | 34230 | <filename>setup.py
from setuptools import setup, find_packages
setup(
name='romodel',
version='0.0.2',
url='https://github.com/johwiebe/romodel.git',
author='<NAME>',
author_email='<EMAIL>',
description='Pyomo robust optimization toolbox',
packages=find_packages(),
install_requires=['py... | 1.078125 | 1 |
lambda_function.py | RAMCO-AMS/AlexaSkill | 1 | 34231 | <reponame>RAMCO-AMS/AlexaSkill
"""
This sample demonstrates a simple skill built with the Amazon Alexa Skills Kit.
The Intent Schema, Custom Slots, and Sample Utterances for this skill, as well
as testing instructions are located at http://amzn.to/1LzFrj6
For additional samples, visit the Alexa Skills Kit Getting Star... | 2.984375 | 3 |
preprocessing/HIPSCI/extract_seq_majiq_exon_cons.py | arnegebert/splicing | 1 | 34232 | <filename>preprocessing/HIPSCI/extract_seq_majiq_exon_cons.py<gh_stars>1-10
from collections import defaultdict, Counter
import numpy as np
import time
from utils import one_hot_encode_seq, reverse_complement, overlap
import matplotlib.pyplot as plt
startt = time.time()
psis = []
data_path = '../../data'
save_to_con... | 2.375 | 2 |
stream/migrations/0001_init_models.py | freejooo/vigilio | 137 | 34233 | <filename>stream/migrations/0001_init_models.py
# Generated by Django 3.1.5 on 2021-03-17 21:30
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_depe... | 1.796875 | 2 |
iris/iris_classifier.py | xuanthuong/tensorflow-course | 0 | 34234 | # -*- coding: utf-8 -*-
"""
Iris classification example, pratice on using high-level API
Algorithms: Neutral Network
Reference: https://www.tensorflow.org/get_started/tflearn
Date: Jun 14, 2017
@author: <NAME>
@Library: tensorflow - high-level API with tf.contrib.learn
"""
from __future__ import absolute_import
fro... | 3.140625 | 3 |
src/main.py | NaBotProject/translate-discord-bot | 1 | 34235 | import discord
import os
import openpyxl
from deep_translator import GoogleTranslator
client = discord.Client()
TOKEN = os.getenv('TOKEN')
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
if message.author ==... | 3.109375 | 3 |
createSampledata.py | sjoplin/Ace-Analytics | 1 | 34236 | <reponame>sjoplin/Ace-Analytics<gh_stars>1-10
# Import all libraries needed for the tutorial
import pandas as pd
import re
import requests
from bs4 import BeautifulSoup
from makePDFs import printPDFs
from time import sleep
#parses the rawtext into panda format
#add playerdata back
def generateStats(playerdata, teamNam... | 3.109375 | 3 |
datasets.py | mokosaur/iris-recognition | 17 | 34237 | <filename>datasets.py
import os
import numpy as np
def load_utiris():
"""Fetches NIR images from UTIRIS dataset.
Retrieves image paths and labels for each NIR image in the dataset. There should already exist a directory named
'UTIRIS V.1'. If it does not exist then download the dataset from the official ... | 3.265625 | 3 |
crescent/resources/s3/bucket/routing_rule.py | mpolatcan/zepyhrus | 1 | 34238 | <reponame>mpolatcan/zepyhrus
from crescent.core import Model
from .redirect_rule import RedirectRule
from .routing_rule_condition import RoutingRuleCondition
from .constants import ModelRequiredProperties
class RoutingRule(Model):
def __init__(self):
super(RoutingRule, self).__init__(required_properties=M... | 2.3125 | 2 |
arranging.py | mallimuondu/Algorithims | 0 | 34239 | <gh_stars>0
input1 = int(input("Enter the first number: "))
input2 = int(input("Enter the second number: "))
input3 = int(input("Enter the third number: "))
input4 = int(input("Enter the fourth number: "))
input5 = int(input("Enter the fifth number: "))
tuple_num = []
tuple_num.append(input1)
tuple_num.append(inpu... | 3.765625 | 4 |
tests/test_validation_settings.py | IndicoDataSolutions/finetune-transformer-lm | 0 | 34240 | import unittest
from finetune.util.input_utils import validation_settings
class TestValidationSettings(unittest.TestCase):
def test_validation_settings(self):
"""
Ensure LM only training does not error out
"""
val_size, val_interval = validation_settings(dataset_size=30, batch_siz... | 2.921875 | 3 |
96. combination_sum.py | chandravenky/puzzles | 0 | 34241 | <reponame>chandravenky/puzzles
import copy
def combination_sum(candidates, target):
def backtrack(first, curr=[]):
if sum(curr) == target:
if curr not in output:
output.append(copy.deepcopy(curr))
return
if sum(curr) >target:
return
for i in range(first, n):
curr.append(ca... | 3.84375 | 4 |
claimreview/claimreview/parser.py | MartinoMensio/claimreview-scraper-other | 2 | 34242 | <gh_stars>1-10
import json
import microdata
import dateutil.parser
class ClaimReviewParser(object):
name_fixes = {
'Politifact': 'PolitiFact'
}
def parse(self, response, language='en'):
items = self.get_microdata_items(response)
scripts = response.css(
'script[type="a... | 2.5625 | 3 |
map/migrations/0001_initial.py | benjaoming/django-denmark.org | 0 | 34243 | # Generated by Django 2.0.3 on 2018-03-16 00:17
from django.conf import settings
import django.contrib.gis.db.models.fields
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependenc... | 1.695313 | 2 |
UNET_EM_DATASET/UNET_EM_DATASET_TERNARY/utility.py | hossein1387/U-Net-Fixed-Point-Quantization-for-Medical-Image-Segmentation | 69 | 34244 | ../UNET_EM_DATASET_BASE/utility.py | 1.015625 | 1 |
frozen_model/gap_model_triplet.py | Yorko/gender-unbiased_BERT-based_pronoun_resolution | 47 | 34245 | <reponame>Yorko/gender-unbiased_BERT-based_pronoun_resolution
import pandas as pd
from tqdm import tqdm
import json
import time
import os
from keras import backend, models, layers, initializers, regularizers, constraints, optimizers
from keras import callbacks as kc
from sklearn.model_selection import cross_val_score, ... | 1.835938 | 2 |
plotly/graph_objs/scattermapbox/__init__.py | gnestor/plotly.py | 12 | 34246 | from ._unselected import Unselected
from plotly.graph_objs.scattermapbox import unselected
from ._textfont import Textfont
from ._stream import Stream
from ._selected import Selected
from plotly.graph_objs.scattermapbox import selected
from ._marker import Marker
from plotly.graph_objs.scattermapbox import marker
from ... | 1.195313 | 1 |
Javatar.py | evandrocoan/Javatar | 142 | 34247 | <reponame>evandrocoan/Javatar
from .commands import *
from .core.event_handler import *
from .utils import (
Constant
)
def plugin_loaded():
Constant.startup()
| 1.179688 | 1 |
sample/posts/filters.py | pine2104/docker_uwsgi_nginx_django | 0 | 34248 | <filename>sample/posts/filters.py<gh_stars>0
from .models import Post, Jcpaper
import django_filters
from django import forms
from django_filters.widgets import RangeWidget
class PostFilter(django_filters.FilterSet):
title = django_filters.CharFilter(
lookup_expr='icontains',
widget=forms.TextInpu... | 2.046875 | 2 |
src/odinapi/utils/datamodel.py | Odin-SMR/odin-api | 0 | 34249 | <reponame>Odin-SMR/odin-api
import attr
from typing import List, Any, Dict, Union
import datetime as dt
from enum import Enum, unique, auto
from dateutil.relativedelta import relativedelta
import numpy as np # type: ignore
DATEFMT = "%Y-%m-%dT%H:%M:%SZ"
COMMON_FILE_HEADER_DATA = {
"creator_name": '<NAME>',
... | 2.53125 | 3 |
regparser/layer/external_citations.py | cfpb/regulations-parser | 36 | 34250 | <gh_stars>10-100
# vim: set encoding=utf-8
from collections import defaultdict
from regparser.grammar import external_citations as grammar
from layer import Layer
class ExternalCitationParser(Layer):
# The different types of citations
CODE_OF_FEDERAL_REGULATIONS = 'CFR'
UNITED_STATES_CODE = 'USC'
PUB... | 2.78125 | 3 |
Server/app.py | Ali-Elganzory/High-Ping | 3 | 34251 | <filename>Server/app.py
import eventlet
import socketio
sio = socketio.Server(async_mode='eventlet')
app = socketio.WSGIApp(sio)
rooms = {}
instructors = {}
clients_in_rooms = {}
@sio.event
def connect(sid, environ):
print("[Server] ", sid, "connected")
@sio.event
def create_room(sid, name, room):
if room... | 2.75 | 3 |
bot.py | Shikib/twiliobot | 0 | 34252 | <gh_stars>0
from telegram import Updater
from twilio.rest import TwilioRestClient
TELEGRAM_TOKEN = "INSERT_YOUR_TOKEN_HERE"
TWILIO_ACCOUNT_SID = "INSERT_ACCOUNT_SID_HERE"
TWILIO_AUTH_TOKEN = "INSERT_AUTH_TOKEN_HERE"
# initialize telegram updater and dispatcher
updater = Updater(token=TELEGRAM_TOKEN)
dispatcher = upda... | 2.984375 | 3 |
Python/construct-the-lexicographically-largest-valid-sequence.py | sm2774us/leetcode_interview_prep_2021 | 0 | 34253 | <reponame>sm2774us/leetcode_interview_prep_2021
# Time: O(n!)
# Space: O(n)
class Solution(object):
def constructDistancedSequence(self, n):
"""
:type n: int
:rtype: List[int]
"""
def backtracking(n, i, result, lookup):
if i == len(result):
retur... | 3.28125 | 3 |
General Questions/Longest_Common_Prefix.py | siddhi-244/CompetitiveProgrammingQuestionBank | 931 | 34254 | #Longest Common Prefix in python
#Implementation of python program to find the longest common prefix amongst the given list of strings.
#If there is no common prefix then returning 0.
#define the function to evaluate the longest common prefix
def longestCommonPrefix(s):
p = '' #declare an empty s... | 4.25 | 4 |
codes/1hop_getTwitterUserDetails.py | hridaydutta123/ActiveProbing | 0 | 34255 | import tweepy
from tweepy import OAuthHandler
import sys
import ConfigParser
from pymongo import MongoClient
import datetime
from random import randint
import time
# Mongo Settings
# Connect to MongoDB
client = MongoClient("hpc.iiitd.edu.in", 27017, maxPoolSize=50)
# Connect to db bitcoindb
db=client.activeprobing
s... | 2.65625 | 3 |
netbox/extras/migrations/0061_extras_change_logging.py | TheFlyingCorpse/netbox | 4,994 | 34256 | from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('extras', '0060_customlink_button_class'),
]
operations = [
migrations.AddField(
model_name='customfield',
name='created',
field=models.DateField(auto_now... | 1.867188 | 2 |
tests/test_deployment/test__issue_tracker.py | getslash/scotty | 10 | 34257 | <gh_stars>1-10
import http
import uuid
from itertools import chain, combinations
import pytest
import requests
import slash
def powerset(iterable):
s = list(iterable)
return (
frozenset(p) for p in chain.from_iterable((combinations(s, r)) for r in range(len(s) + 1))
)
def test_empty_issue(track... | 2.125 | 2 |
iotcookbook/device/pi/docker/buzzer/app/client.py | haizaar/crossbar-examples | 0 | 34258 | <filename>iotcookbook/device/pi/docker/buzzer/app/client.py
import os
import argparse
import six
import txaio
txaio.use_twisted()
import RPi.GPIO as GPIO
from twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks
from twisted.internet.error import ReactorNotRunning
from autobahn.twiste... | 2.21875 | 2 |
troupon/deals/tasks.py | andela/troupon | 14 | 34259 | <reponame>andela/troupon<filename>troupon/deals/tasks.py<gh_stars>10-100
from celery.decorators import periodic_task
from celery.task.schedules import crontab
from celery.utils.log import get_task_logger
from utils import scraper
logger = get_task_logger(__name__)
# A periodic task that will run every minute
@perio... | 2.453125 | 2 |
unit_testing/temp_manage.py | ddsprasad/pythondev | 0 | 34260 | from memsql.common import database
import sys
from datetime import datetime
DATABASE = 'PREPDB'
HOST = '10.1.100.12'
PORT = '3306'
USER = 'root'
PASSWORD = '<PASSWORD>'
def get_connection(db=DATABASE):
""" Returns a new connection to the database. """
return database.connect(host=HOST, port=PORT, user=USER, ... | 2.703125 | 3 |
tabcmd/parsers/remove_users_parser.py | WillAyd/tabcmd | 0 | 34261 | from .global_options import *
class RemoveUserParser:
"""
Parser to removeusers command
"""
@staticmethod
def remove_user_parser(manager, command):
"""Method to parse remove user arguments passed by the user"""
remove_users_parser = manager.include(command)
remove_users_pa... | 2.71875 | 3 |
Lab6/passengers.py | programiranje3/v2020 | 0 | 34262 | <filename>Lab6/passengers.py
#
# Create the FlightService enumeration that defines the following items (services):
# (free) snack, (free) refreshments, (free) meal, priority boarding,
# (free) onboard wifi, and an item for cases when services are not specified.
#
from enum import Enum
class FlightService(Enum):
... | 3.421875 | 3 |
src/documents/management/commands/generate_documents.py | Talengi/phase | 8 | 34263 | #!/usr/bin/python
# -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand
from documents.tests.utils import generate_random_documents
from categories.models import Category
class Command(BaseCommand):
args = '<number_of_documents> <category_id>'
help = 'Creates a given number of random d... | 2.34375 | 2 |
checkov/kubernetes/checks/resource/k8s/ImagePullPolicyAlways.py | Devocean8-Official/checkov | 1 | 34264 | import re
from typing import Any, Dict
from checkov.common.models.consts import DOCKER_IMAGE_REGEX
from checkov.common.models.enums import CheckResult
from checkov.kubernetes.checks.resource.base_container_check import BaseK8sContainerCheck
class ImagePullPolicyAlways(BaseK8sContainerCheck):
def __init__(self) -... | 2.25 | 2 |
jobs/migrations/0018_rename_user_id_recruiterpage_user.py | digitaloxford/do-wagtail | 2 | 34265 | <filename>jobs/migrations/0018_rename_user_id_recruiterpage_user.py<gh_stars>1-10
# Generated by Django 3.2.6 on 2021-08-05 11:05
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('jobs', '0017_rename_user_recruiterpage_user_id'),
]
operations = [
... | 1.632813 | 2 |
celescope/fusion/multi_fusion.py | frostmoure98/CeleScope | 0 | 34266 | import os
import glob
import sys
import argparse
import re
from collections import defaultdict
from celescope.__init__ import __CONDA__
from celescope.fusion.__init__ import __STEPS__, __ASSAY__
from celescope.tools.utils import merge_report, generate_sjm
from celescope.tools.utils import parse_map_col4, multi_opts, li... | 1.960938 | 2 |
src/uglier/colored_logger.py | MonliH/uglier | 1 | 34267 | <gh_stars>1-10
# Credits to https://stackoverflow.com/a/56944256/9470078
# I wanted a colored logger without dependencies, so here it is!
import logging
class ColoredFormatter(logging.Formatter):
grey = "\x1b[38;20m"
yellow = "\x1b[33;20m"
red = "\x1b[31;20m"
blue = "\x1b[34;20m"
bold_red = "\x1b[... | 2.828125 | 3 |
tests/SHA256/run.py | weikengchen/Virgo | 9 | 34268 | <gh_stars>1-10
import os
os.system('mkdir -p LOG')
for i in range(8):
os.system('./zk_proof SHA256_64_merkle_' + str(i + 1) + '_circuit.txt SHA256_64_merkle_' + str(i + 1) + '_meta.txt LOG/SHA256_' + str(i + 1) + '.txt')
| 1.820313 | 2 |
projects/07/src/Parser.py | danibachar/Nand2Tetris | 0 | 34269 | from Lex import Lex, ARITHMETIC_COMMANDS, PUSH_OR_POP_COMMANDS
class Parser:
def __init__(self, src_file_name):
self._line_index = 0
self._line_index = 0
self._lines = []
f = open(src_file_name)
# First assesment of the Assembler
for line in f.readlines():
... | 3.28125 | 3 |
testing/examples/import_error.py | dry-python/dependencies | 175 | 34270 | from astral import Vision # noqa: F401
| 0.972656 | 1 |
pywxwork/contact/async.py | renqiukai/pywxwork | 2 | 34271 | from loguru import logger
from ..base import base
class async(base):
def __init__(self, token) -> None:
super().__init__(token)
def syncuser(self, data):
api_name = "batch/syncuser"
response = self.request(
api_name=api_name, method="post", json=data)
logger.debug(... | 2.203125 | 2 |
saleor/University/migrations/0012_auto_20191220_1226.py | pandeyroshan/Saleor | 0 | 34272 | # Generated by Django 2.2 on 2019-12-20 06:56
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('University', '0011_auto_20191219_1913'),
]
operations = [
migrations.RemoveField(
model_name='university',
name='user',
... | 1.507813 | 2 |
app/places/migrations/0001_initial.py | aykutgk/nearapp-web | 0 | 34273 | <reponame>aykutgk/nearapp-web
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-04-06 23:40
from __future__ import unicode_literals
from django.conf import settings
import django.contrib.gis.db.models.fields
from django.db import migrations, models
import django.db.models.deletion
class Migration(migratio... | 1.617188 | 2 |
acmgnyr2011/b.py | AnAverageHuman/competitive | 0 | 34274 | #!/usr/bin/env python
P = int(input())
for _ in range(P):
N, n, m = [int(i) for i in input().split()]
print(f"{N} {(n - m) * m + 1}")
| 3.296875 | 3 |
preprocessing/importlib_read.py | Kunal614/Machine-Learning | 0 | 34275 | #importing lib
import pandas as pd
import numpy as np
#Take data
df = pd.DataFrame({"Name":['Kunal' , 'Mohit' , 'Rohit' ] ,"age":[np.nan , 23, 45] , "sex":['M' , np.nan , 'M']})
#check for nnull value
print(df.isnull().sum())
print(df.describe())
# ignore the nan rows
print(len(df.dropna()) , df.dropna())
#for ... | 3.6875 | 4 |
isw2-master/src/app/ui/ajustarReloj.py | marlanbar/academic-projects | 0 | 34276 | import datetime
from .consola import Consola
from .uiscreen import UIScreen
from ..core.reloj import Reloj
class AjustarReloj(UIScreen):
def __init__(self, unMain, unUsuario):
super().__init__(unMain)
self.usuario = unUsuario
def run(self):
self.consola.prnt("")
self.consola.prnt(" Ahora: %s" %... | 2.828125 | 3 |
signin/jd.py | nujabse/simpleSignin | 11 | 34277 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import traceback
from selenium.webdriver import ChromeOptions
from signin.chrome import find_chrome_driver_path, JdSession
from signin.jd_job import jobs_all
from lib.log import logger
from lib.settings import PC_UA
from lib.settings import MOBILE_UA
class JDUser:
... | 2.5 | 2 |
tests/tasks/test_aws_athena_task.py | jezd-axyl/platsec-aws-scanner | 0 | 34278 | from unittest import TestCase
from unittest.mock import Mock
from tests.test_types_generator import athena_task
class TestAwsAthenaTask(TestCase):
def test_run_task(self) -> None:
with self.assertRaises(NotImplementedError):
athena_task()._run_task(Mock())
| 2.390625 | 2 |
Post-Exploitation/LaZagne/Linux/lazagne/softwares/wallet/gnome.py | FOGSEC/TID3xploits | 5 | 34279 | <reponame>FOGSEC/TID3xploits
#!/usr/bin/env python
import os
from lazagne.config.write_output import print_debug
from lazagne.config.moduleInfo import ModuleInfo
class Gnome(ModuleInfo):
def __init__(self):
options = {'command': '-g', 'action': 'store_true', 'dest': 'gnomeKeyring', 'help': 'Gnome Keyring'}
Module... | 2.03125 | 2 |
clearsky/main.py | NathanStern/ClearSky | 0 | 34280 | from . import db
from flask import Flask, current_app
from . import create_app
import os
from . import db
app = create_app()
with app.app_context():
if os.path.exists("clearsky/config.json"):
pass
else:
with open('clearsky/config.json', 'w') as configuration:
print("Opened config ... | 2.5625 | 3 |
logger.py | despargy/Shade | 3 | 34281 | import logging
from abc import ABC, abstractmethod
from file_read_backwards import FileReadBackwards
import threading
import os
class Logger(ABC):
def __init__(self,filename):
self.lock = threading.Lock()
self.dir = "Logs"
if(not os.path.isdir(self.dir)):
os.mkdir(self.dir)
... | 3.171875 | 3 |
nydus/db/base.py | Elec/nydus | 102 | 34282 | <reponame>Elec/nydus<gh_stars>100-1000
"""
nydus.db.base
~~~~~~~~~~~~~
:copyright: (c) 2011-2012 DISQUS.
:license: Apache License 2.0, see LICENSE for more details.
"""
__all__ = ('LazyConnectionHandler', 'BaseCluster')
import collections
from nydus.db.map import DistributedContextManager
from nydus.db.routers impor... | 2.296875 | 2 |
pytest_voluptuous/plugin.py | F-Secure/pytest-voluptuous | 27 | 34283 | <reponame>F-Secure/pytest-voluptuous
from __future__ import absolute_import
from voluptuous import MultipleInvalid
from pytest_voluptuous.voluptuous import S
def pytest_assertrepr_compare(op, left, right):
if isinstance(left, S) and (op == '<=' or op == '==') or isinstance(right, S) and op == '==':
if i... | 2.484375 | 2 |
amftrack/pipeline/scripts/post_processing/make_small_exp.py | Cocopyth/MscThesis | 1 | 34284 | from path import path_code_dir
import sys
sys.path.insert(0, path_code_dir)
from amftrack.pipeline.functions.image_processing.extract_width_fun import *
from amftrack.pipeline.functions.image_processing.experiment_class_surf import Experiment, save_graphs, load_graphs
from amftrack.util import get_dates_datetime... | 2.1875 | 2 |
src/style_transfer/style_transfer_v2_gluon.py | gilbertfrancois/mxnet-cookbook | 1 | 34285 | # Copyright 2019 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | 2.3125 | 2 |
torncache/connection.py | shipci/torncache-sample | 0 | 34286 | <gh_stars>0
# -*- mode: python; coding: utf-8 -*-
"""
Torncache Connection
"""
from __future__ import absolute_import
import os
import stat
import socket
import time
import numbers
import logging
import functools
from tornado import iostream
from tornado import stack_context
from tornado.ioloop import IOLoop
from t... | 2.328125 | 2 |
rl-toolkit/rlf/rl/model.py | clvrai/goal_prox_il | 4 | 34287 | <gh_stars>1-10
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from rlf.rl.loggers import sanity_checker
def weight_init(module, weight_init, bias_init, gain=1):
weight_init(module.weight.data, gain=gain)
bias_init(module.bias.data)
return module
def no_bias_weight_... | 2.390625 | 2 |
pkgs/sdk-pkg/src/genie/libs/sdk/apis/iosxe/apphosting/verify.py | jbronikowski/genielibs | 94 | 34288 | ''' Common Verify functions for IOX / app-hosting '''
import logging
import time
log = logging.getLogger(__name__)
# Import parser
from genie.utils.timeout import Timeout
from genie.metaparser.util.exceptions import SchemaEmptyParserError
def verify_app_requested_state(device, app_list=None, requested_st... | 2.703125 | 3 |
memo/models/neural_nets.py | feloundou/memo | 0 | 34289 | # import scipy.signal
from gym.spaces import Box, Discrete
import numpy as np
import torch
from torch import nn
import IPython
# from torch.nn import Parameter
import torch.nn.functional as F
from torch.distributions import Independent, OneHotCategorical, Categorical
from torch.distributions.normal import Normal
# # fr... | 2.46875 | 2 |
sprocket/util/extfrm.py | zhouming-hfut/sprocket | 500 | 34290 | <reponame>zhouming-hfut/sprocket<gh_stars>100-1000
# -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import
import numpy as np
def extfrm(data, npow, power_threshold=-20):
"""Extract frame over the power threshold
Parameters
----------
data: array, shape (`T`, `dim`)... | 2.453125 | 2 |
tickets_handler/models.py | ChanTerelLy/partnerweb3 | 0 | 34291 | <filename>tickets_handler/models.py
import uuid
from django.db import models
from partnerweb_parser.manager import NewDesign, Ticket
import re
from partnerweb_parser import system, mail, manager
import json
import datetime
from partnerweb_parser.date_func import dmYHM_to_datetime
from tickets_handler.tasks import upda... | 2.125 | 2 |
photos/views.py | Otybrian/personal-gallery | 0 | 34292 | from django.shortcuts import render
from django.http import HttpResponse
import datetime as dt
from django.views import View
from photos.models import Image, category
# Create your views here.
def welcome(request):
return render(request, 'welcome.html')
def display_page(request):
image = Image.objects.all()... | 2.265625 | 2 |
sem/constants.py | YoannDupont/SEM | 22 | 34293 | <filename>sem/constants.py
# -*- coding: utf-8 -*-
"""
file: constants.py
Description: some useful constants that could be of some use in SEM and
beyond.
author: <NAME>
MIT License
Copyright (c) 2018 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associate... | 1.554688 | 2 |
newsbreak.py | mitchsmith/news_munger | 0 | 34294 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
""" This module provides a command line interface to news_munger. """
import datetime
import random
import argparse
from munger import DocumentCatalog, Munger
parser = argparse.ArgumentParser()
parser.parse_args()
## Classes ##
class MadLib(Munger):
"""Real soo... | 3.203125 | 3 |
pipeline/dag.py | OpenSourceEconomics/pipeline | 3 | 34295 | """This module contains the code related to the DAG and the scheduler."""
from pathlib import Path
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
from matplotlib.colors import LinearSegmentedColormap
from mpl_toolkits.axes_grid1 import make_axes_locatable
from networkx.drawing import nx_pydot... | 2.84375 | 3 |
windyquery/validator/fullname_json.py | bluerelay/windyquery | 51 | 34296 | <reponame>bluerelay/windyquery
from windyquery.provider._base import JSONB
from ._base import _rule
from .fullname import Fullname
from .number import Number
from .operators.minus import Minus
class FullnameJson(Fullname, Number, Minus):
reserved = {**Fullname.reserved, **Number.reserved, **Minus.reserved}
to... | 2.421875 | 2 |
heatmap/__init__.py | Bilal-Yousaf/heatmap | 5 | 34297 | from .heatmap import generate_heatmap | 1.039063 | 1 |
download-files.py | CrowderSoup/download-files | 0 | 34298 | import os, os.path, urllib.request, sys, getopt
def main(argv):
print(argv)
input_file = ''
download_dir = ''
try:
opts, args = getopt.getopt(argv,
"hi:d:",
["input-file=","download-dir="])
except getopt.GetoptError as ... | 3.171875 | 3 |
pynif3d/pipeline/base_pipeline.py | pfnet/pynif3d | 66 | 34299 | <filename>pynif3d/pipeline/base_pipeline.py
import os
import gdown
import torch
import yaml
from pynif3d.common.verification import check_in_options, check_path_exists
from pynif3d.log.log_funcs import func_logger
class BasePipeline(torch.nn.Module):
@func_logger
def __init__(self):
super().__init__... | 2.203125 | 2 |