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 |
|---|---|---|---|---|---|---|
ais3-pre-exam-2022-writeup/Misc/JeetQode/chall/problems/astmath.py | Jimmy01240397/balsn-2021-writeup | 0 | 7700 | from problem import Problem
from typing import Any, Tuple
from random import randint
import ast
import json
def gen_num():
return str(randint(1, 9))
def gen_op():
return "+-*/"[randint(0, 3)]
def gen_expr(depth):
if randint(0, depth) == 0:
l = gen_expr(depth + 1)
r = gen_expr(depth + 1... | 3.265625 | 3 |
pyllusion/movement/movement_circles.py | RebeccaHirst/Pyllusion | 0 | 7701 | <filename>pyllusion/movement/movement_circles.py
import numpy as np
from .movement_matrix import movement_matrix
from ..image import image_circles
def movement_circles(n=50, duration=2, fps=30, width=500, height=500, **kwargs):
"""
>>> import pyllusion as ill
>>>
>>> images = ill.movement_circles(n=50... | 3.125 | 3 |
sce.py | hzwfl2/Semantic-consistent-Embedding | 2 | 7702 | <gh_stars>1-10
#%%
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import accuracy_score
from sklearn.naive_bayes impor... | 2.328125 | 2 |
graphsage/partition_predict.py | colirain/GraphSAGE | 0 | 7703 |
import tensorflow as tf
import numpy as np
from graphsage.models import FCPartition
from graphsage.partition_train import construct_placeholders
from graphsage.utils import load_graph_data, load_embedded_data, load_embedded_idmap
flags = tf.app.flags
FLAGS = flags.FLAGS
# flags.DEFINE_integer('dim_1', ... | 2.046875 | 2 |
scripts/generate_XML_files/DS1/annotatedsen_to_xml.py | AmmarQaseem/CPI-Pipeline-test | 0 | 7704 | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Copyright (c) 2015, <NAME> <<EMAIL>>, <NAME> <<EMAIL>>
This parser reads annotated sentences (output from get_relations.py) in a tab-separated format to generate a unified XML format (Tikk et al., 2010. A comprehensive benchmark of kernel methods to extract pr... | 2.765625 | 3 |
tests/test_add_contact.py | SergeyDorokhov/python_training | 0 | 7705 | def test_add_contact(app, db, json_contacts, check_ui):
contact = json_contacts
list_before = db.get_contact_list()
contact.id_contact = app.contact.get_next_id(list_before)
app.contact.create(contact)
assert len(list_before) + 1 == len(db.get_contact_list())
list_after = db.get_contact_list()
... | 2.59375 | 3 |
website/members/urls.py | eamanu/asoc_members | 0 | 7706 | <reponame>eamanu/asoc_members
from django.conf import settings
from django.conf.urls.static import static
from django.urls import path
from members import views
urlpatterns = [
path('solicitud-alta/', views.signup_initial, name='signup'),
path('solicitud-alta/persona/', views.signup_form_person, name='signup_... | 1.8125 | 2 |
Benchmarking/Keras/Tensorflow/TF_dataforcomparisongraphss.py | vais-ral/CCPi-ML | 0 | 7707 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 18 14:04:03 2018
@author: zyv57124
"""
import scipy.io as sio
import tensorflow as tf
from tensorflow import keras
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from tensorflow.python.training import gradient_descent
from tim... | 2.65625 | 3 |
Exercise_8.py | aurimas13/Python-stuff | 1 | 7708 | <filename>Exercise_8.py
# Solution of Exercise 8 - Exercise_8.py
#
# Uploaded by <NAME> on 11/23/20.
# Updated by <NAME> on 11/06/21.
formatter = "%r %r %r %r"
print formatter % (1, 2, 3, 4)
print formatter % ("one", "two", "three", "four")
print formatter % (True, False, False, True)
print formatter % (formatter, f... | 3.578125 | 4 |
Easy/two-numbers-sum/solution-1.py | MCFrank16/python-algo | 0 | 7709 | <gh_stars>0
# solution 1: Brute Force
# time complexity: O(n^2)
# space complexity: O(1)
def twoNumberSum(arr, n):
for i in range(len(arr) - 1):
firstNum = arr[i]
for j in range(i + 1, len(arr)):
secondNum = arr[j]
if firstNum + secondNum == n:
r... | 3.71875 | 4 |
python/cac_tripplanner/destinations/migrations/0021_event.py | maurizi/cac-tripplanner | 0 | 7710 | <filename>python/cac_tripplanner/destinations/migrations/0021_event.py<gh_stars>0
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-11-28 17:32
from __future__ import unicode_literals
import ckeditor.fields
import destinations.models
from django.db import migrations, models
import django.db.models.deletion
... | 1.695313 | 2 |
data_extraction/scripts/bnf_adr_extraction.py | elpidakon/CRESCENDDI | 0 | 7711 | # Kontsioti, Maskell, Dutta & Pirmohamed, A reference set of clinically relevant
# adverse drug-drug interactions (2021)
# Code to extract single-drug side effect data from the BNF website
from bs4 import BeautifulSoup
import urllib
import os, csv
import numpy as np
import pandas as pd
import re
from tqdm i... | 3.1875 | 3 |
core/forms.py | nicoknoll/howimetcorona | 1 | 7712 | <reponame>nicoknoll/howimetcorona<filename>core/forms.py
from django import forms
class BaseFileForm(forms.Form):
# we try to minify the file to only submit the data
points_file = forms.FileField(
required=False,
widget=forms.FileInput(attrs={'required': 'required'}),
label="Location H... | 2.6875 | 3 |
bartender/drinks/generators.py | autiwg/bartender | 0 | 7713 | from django.utils import timezone
from django.utils.text import slugify
def generate_billed_document_path(instance, filename):
cur_time = timezone.now()
return f"{cur_time.strftime('%Y/%m')}/{slugify(instance.name)}-{cur_time.strftime('%d.%m.%Y %H:%M')}.csv"
| 2.4375 | 2 |
papers/wdmerger_I/plots/sponge.py | AMReX-Astro/wdmerger | 2 | 7714 | <gh_stars>1-10
# This Python program is used to create a plot displaying the sponge
# function we use in the CASTRO hydrodynamics for the wdmerger problem.
import numpy as np
import matplotlib.pyplot as plt
def sponge(r):
sp
rs = 0.75
rt = 0.85
r = np.linspace(0.0, 1.0, 1000)
f = np.zeros(len(r))
idx = np.whe... | 2.921875 | 3 |
Python/110-1/Midterm Additional HW/005.py | JenFuChen/NKUST | 3 | 7715 | <gh_stars>1-10
# 005 印出菱形
while(1):
level = int(input())
if(level <= 0):
break
L = 2*level-1
mid = int((L - 1) / 2)
inspa = mid * 2 - 1
for i in range(L):
spa = level - i - 1
if spa >= 0:
print(" " * spa, end='')
print('*', end='')
... | 3.265625 | 3 |
dynamo/plot/pseudotime.py | davisidarta/dynamo-release | 0 | 7716 | <reponame>davisidarta/dynamo-release<gh_stars>0
import numpy as np
from ..tools.utils import update_dict
from .utils import save_fig
def plot_direct_graph(adata,
layout=None,
figsize=[6, 4],
save_show_or_return='show',
save_kwargs... | 2.15625 | 2 |
ocean_lib/web3_internal/utils.py | joshualyguessennd/ocean.py | 0 | 7717 | <reponame>joshualyguessennd/ocean.py<filename>ocean_lib/web3_internal/utils.py
# Copyright 2018 Ocean Protocol Foundation
# SPDX-License-Identifier: Apache-2.0
import json
import logging
import os
from collections import namedtuple
import eth_account
import eth_keys
import eth_utils
from eth_keys import KeyAPI
from ... | 2.578125 | 3 |
autofront/__init__.py | JimmyLamothe/autofront | 1 | 7718 | <gh_stars>1-10
import autofront.autofront as autofront
import autofront.utilities as utilities
initialize = autofront.initialize
add = autofront.add
run = autofront.run
get_display = utilities.get_display
| 1.140625 | 1 |
src/main.py | ketsonroberto/PBDO | 0 | 7719 | <reponame>ketsonroberto/PBDO<filename>src/main.py
# THIS IS A FILE TO TEST THE CODE. DO NOT USE IT AS PART OF THE CODE.
import matplotlib.pyplot as plt
import numpy as np
from StochasticMechanics import Stochastic
from scipy.optimize import minimize
from Performance import PerformanceOpt
from Hazards import Stationary... | 2.125 | 2 |
categorical_embedder/embedders/core/aux/custom_object_handler.py | erelcan/categorical-embedder | 3 | 7720 | from categorical_embedder.embedders.core.aux.custom_layers import get_custom_layer_class
from categorical_embedder.embedders.core.aux.loss_factory import get_loss_function
def prepare_custom_objects(custom_object_info):
custom_objects = {}
custom_objects.update(_prepare_custom_layers(custom_object_info["layer... | 2.5625 | 3 |
osprofiler/cmd/shell.py | charliebr30/osprofiler | 0 | 7721 | <reponame>charliebr30/osprofiler<filename>osprofiler/cmd/shell.py
# Copyright 2014 Mirantis Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# ht... | 1.773438 | 2 |
bmt/util.py | patrickkwang/bmt-lite | 0 | 7722 | """Utilities."""
from functools import wraps
import re
from typing import Callable, List, Optional, TypeVar, Union
from .data import (
all_classes, all_slots,
)
def pascal_to_snake(s: str, sep: str = "_") -> str:
"""Convert Pascal case to snake case.
Assumes that
a) all words are either all-lowercas... | 3.703125 | 4 |
src/py_to_json/__init__.py | jlevitt/py-to-json | 0 | 7723 | #
# OMNIVORE CONFIDENTIAL
# __________________
#
# [2013] - [2019] Omnivore Technologies
# All Rights Reserved.
#
# NOTICE: All information contained herein is, and remains
# the property of Omnivore Technologies and its suppliers,
# if any. The intellectual and technical concepts contained
# herein are proprietary... | 0.734375 | 1 |
sktime/utils/time_series.py | brettkoonce/sktime | 1 | 7724 | <filename>sktime/utils/time_series.py
__author__ = ["<NAME>"]
__all__ = [
"compute_relative_to_n_timepoints",
"time_series_slope",
"fit_trend",
"remove_trend",
"add_trend"
]
import numpy as np
from sklearn.utils import check_array
from sktime.utils.validation.forecasting import check_time_index
... | 2.703125 | 3 |
prog_vae/prog_encoder/prog_encoder.py | Hanjun-Dai/sdvae | 70 | 7725 | <reponame>Hanjun-Dai/sdvae
#!/usr/bin/env python
from __future__ import print_function
import os
import sys
import csv
import numpy as np
import math
import random
from collections import defaultdict
import torch
from torch.autograd import Variable
from torch.nn.parameter import Parameter
import torch.nn as nn
import... | 1.875 | 2 |
pyvmu/messages.py | JosephRedfern/VarienseVMU | 5 | 7726 | from collections import namedtuple
Accelerometer = namedtuple('Accelerometer', ["timestamp", "x", "y", "z"])
Magnetometer = namedtuple('Magnetometer', ['timestamp', 'x', 'y', 'z'])
Gyroscope = namedtuple('Gyroscope', ['timestamp', 'x', 'y', 'z'])
Euler = namedtuple('Euler', ['timestamp', 'x', 'y', 'z'])
Quaternion = ... | 2.9375 | 3 |
scripts/Caesar-Cipher/CaesarCipher.py | Pythobit/python-projects | 2 | 7727 | <filename>scripts/Caesar-Cipher/CaesarCipher.py
from __future__ import print_function
import os
import string
import argparse
try:
maketrans = string.maketrans # python2
except AttributeError:
maketrans = str.maketrans # python3
def caeser_cipher(string_: str, offset: int, decode: bool, file_: string) -> N... | 4 | 4 |
onadata/libs/permissions.py | BuildAMovement/whistler-kobocat | 38 | 7728 | <reponame>BuildAMovement/whistler-kobocat
from collections import defaultdict
from django.contrib.contenttypes.models import ContentType
from guardian.shortcuts import (
assign_perm,
remove_perm,
get_perms,
get_users_with_perms)
from onadata.apps.api.models import OrganizationProfile
from onadata.apps... | 1.828125 | 2 |
lanelines.py | gauborg/lane-finding-gborgaonkar | 0 | 7729 | <gh_stars>0
# Self-Driving Car Engineer Nanodegree
#
# ## Project: **Finding Lane Lines on the Road**
# ## Import Packages
#importing some useful packages
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import cv2
import math
import moviepy
image = mpimg.imread('test_images/sol... | 3.8125 | 4 |
zict/zip.py | phobson/zict | 0 | 7730 | try:
from collections.abc import MutableMapping
except ImportError:
from collections import MutableMapping
import zipfile
class Zip(MutableMapping):
"""Mutable Mapping interface to a Zip file
Keys must be strings, values must be bytes
Parameters
----------
filename: string
mode: stri... | 3.1875 | 3 |
neutron_lbaas/drivers/driver_mixins.py | containers-kraken/neutron-lbaas | 0 | 7731 | # Copyright 2014 A10 Networks
#
# 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 agree... | 1.671875 | 2 |
Lib/hTools2/modules/ftp.py | miguelsousa/hTools2 | 0 | 7732 | <filename>Lib/hTools2/modules/ftp.py
# [h] hTools2.modules.ftp
"""Tools to connect to a FTP server, upload files etc."""
# This module uses the `ftplib` library to handle FTP connection and upload.
# http://docs.python.org/library/ftplib.html
import os
from ftplib import FTP
def connect_to_server(url, login, passwo... | 3.359375 | 3 |
network/pytorch2onnx.py | MRsoymilk/toy-car | 0 | 7733 | import Net
import configparser
import torch
from PIL import Image
config = configparser.ConfigParser()
config.read('./config.ini')
MODEL = config.get("Network", "Model")
transformations = Net.transformations
net = Net.Net()
net.eval()
net.load_state_dict(torch.load(MODEL))
image = Image.open("./html/rwby.jpg")
imag... | 2.625 | 3 |
var/spack/repos/builtin/packages/r-gridextra/package.py | player1537-forks/spack | 11 | 7734 | # Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RGridextra(RPackage):
"""Miscellaneous Functions for "Grid" Graphics.
Provides a numb... | 1.171875 | 1 |
tuframework/training/network_training/competitions_with_custom_Trainers/MMS/nnUNetTrainerV2_MMS.py | Magnety/tuFramework | 0 | 7735 | import torch
from tuframework.network_architecture.generic_UNet import Generic_UNet
from tuframework.network_architecture.initialization import InitWeights_He
from tuframework.training.network_training.tuframework_variants.data_augmentation.tuframeworkTrainerV2_insaneDA import \
tuframeworkTrainerV2_insaneDA
from t... | 2.015625 | 2 |
ansible/playbooks/roles/repository/files/download-requirements/src/command/yum.py | romsok24/epiphany | 0 | 7736 | <reponame>romsok24/epiphany
from typing import List
from src.command.command import Command
class Yum(Command):
"""
Interface for `yum`
"""
def __init__(self, retries: int):
super().__init__('yum', retries)
def update(self, enablerepo: str,
package: str = None,
... | 2.515625 | 3 |
build/generate_confirmed_cases_by_counties.py | jtagcat/koroonakaart | 1 | 7737 | from build.chart_data_functions import get_confirmed_cases_by_county
from build.chart_data_functions import get_county_by_day
from build.constants import CONFIRMED_CASES_BY_COUNTIES_PATH
from build.constants import COUNTY_MAPPING
from build.constants import COUNTY_POPULATION
from build.constants import DATE_SETTINGS
fr... | 2.0625 | 2 |
ros_tf_publisher.py | BrightLamp/PyLearningCodes | 0 | 7738 | # encoding=utf-8
import rospy
import tf
if __name__ == '__main__':
rospy.init_node('py_tf_broadcaster')
br = tf.TransformBroadcaster()
x = 0.0
y = 0.0
z = 0.0
roll = 0
pitch = 0
yaw = 1.57
rate = rospy.Rate(1)
while not rospy.is_shutdown():
yaw = yaw + 0.1
roll... | 2.34375 | 2 |
dataset_manager/technical_indicators.py | NightingaleV/bakalarska_prace-ann-algotrading | 0 | 7739 | <reponame>NightingaleV/bakalarska_prace-ann-algotrading
# Imports
import numpy as np
class TechnicalIndicators:
cci_constant = 0.015
def __init__(self):
self.df = None
# Exponentially-weighted moving average
def ewma(self, periods):
indicator = 'EWMA{}'.format(periods)
self.d... | 2.4375 | 2 |
users/models.py | makutas/CocktailWebsite | 0 | 7740 | <gh_stars>0
from django.db import models
from django.contrib.auth.models import User
class UserProfile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
user_description = models.CharField(max_length=200, null=True)
user_avatar = models.ImageField(null=True, blank=True)
user_... | 2.328125 | 2 |
deploy/trained_model.py | Samyak005/Multi-Hop-QG | 0 | 7741 |
import torch
import logging
# Transformer version 4.9.1 - Newer versions may not work.
from transformers import AutoTokenizer
from trained_gpt_model import get_inference2
def t5_supp_inference(review_text):
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') # CPU may not work, got to check.
... | 2.109375 | 2 |
parlai/agents/drqa/config.py | shagunsodhani/ParlAI | 1 | 7742 | # Copyright (c) 2017-present, Facebook, 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. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
import os
import sys
import... | 2.09375 | 2 |
gen4service/gen4bean.py | yongli82/CodeGenerator | 0 | 7743 | <filename>gen4service/gen4bean.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import sys
reload(sys)
sys.path.append("..")
sys.setdefaultencoding('utf-8')
from jinja2 import Environment
from jinja2 import Template
import re
from sqlalchemy import schema, types
from sqlalchemy.engine import create_engine
impo... | 1.953125 | 2 |
Log_tao.py | zigzax/Basic_Python | 0 | 7744 | <gh_stars>0
Python 3.9.0 (tags/v3.9.0:9cf6752, Oct 5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> import turtle
>>> tao = turtle.Turtle()
>>> tao.shape('turtle')
>>> tao.forward(100)
>>> tao.left(90)
>>> tao.forward(100)
>>> t... | 3.5 | 4 |
run.py | pome-ta/CodeMirror | 0 | 7745 | """
Pythonista3 app CodeMirror
"""
import pythonista.wkwebview as wkwebview
import ui
import pathlib
uri = pathlib.Path('./main_index.html')
class View(ui.View):
def __init__(self):
self.wv = wkwebview.WKWebView(flex='WH')
self.wv.load_url(str(uri))
self.add_subview(self.wv)
def will_close(self):
... | 2.328125 | 2 |
gen_cnn_dataset.py | NPCai/graphene-py | 5 | 7746 | <gh_stars>1-10
import wrapper as w
from multiprocessing import Process
import atexit
import time
from queue import Queue
''' 8 Processes, 24 threads per process = 192 threads '''
NUM_PROCESSES = 8
workerList = [] # Worker processes
class Worker(Process): # Need multiple threads or else it takes forever
def __init_... | 2.984375 | 3 |
torch/_prims/context.py | EikanWang/pytorch | 0 | 7747 | <filename>torch/_prims/context.py
from typing import Callable, Sequence, Any, Dict
import functools
import torch
import torch.overrides
from torch._prims.utils import torch_function_passthrough
import torch._refs as refs
import torch._refs
import torch._refs.nn
import torch._refs.nn.functional
import torch._refs.sp... | 2.34375 | 2 |
search/tests/test_read_similarities.py | cotsog/pathways-backend | 0 | 7748 | from django.test import TestCase
from search.read_similarities import build_manual_similarity_map
from common.testhelpers.random_test_values import a_string, a_float
class TestReadingManualTaskSimilarities(TestCase):
def test_convert_matrix_to_map_from_topic_to_array_of_services(self):
data = [
... | 2.71875 | 3 |
fortuna/fortuna.py | Zabamund/HackCPH18 | 3 | 7749 | """
Fortuna
Python project to visualize uncertatinty in probabilistic exploration models.
Created on 09/06/2018
@authors: <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>
"""
# Import libraries
import numpy as np
import glob
from matplotlib import pyplot as plt
import pandas as pd
import xarray as xr
import pyproj a... | 3.046875 | 3 |
resize.py | Linx3/6.867-Final-Project | 3 | 7750 | from PIL import Image
# open an image file (.bmp,.jpg,.png,.gif) you have in the working folder
# //imageFile = "03802.png"
import os
arr=os.listdir()
for imageFile in arr:
if "png" in imageFile:
im1 = Image.open(imageFile)
# adjust width and height to your needs
width = 416
heigh... | 3.453125 | 3 |
src/game/exceptions.py | UnBParadigmas/2020.1_G2_SMA_DarwInPython | 0 | 7751 | class InvalidMovementException(Exception):
pass
class InvalidMovementTargetException(InvalidMovementException):
pass
class InvalidMovimentOriginException(InvalidMovementException):
pass | 1.617188 | 2 |
src/pipeline/sentence-retrieval/run.py | simonepri/fever-transformers | 8 | 7752 | <filename>src/pipeline/sentence-retrieval/run.py
#!/usr/bin/env python3
import argparse
import bisect
import csv
import json
import os
from collections import defaultdict
from functools import reduce
from tqdm import tqdm
def get_best_evidence(scores_file, max_sentences_per_claim):
weighted_claim_evidence = def... | 2.640625 | 3 |
bot/__main__.py | KOTBOTS/Telegram-CloneBot | 1 | 7753 | from telegram.ext import CommandHandler, run_async
from bot.gDrive import GoogleDriveHelper
from bot.fs_utils import get_readable_file_size
from bot import LOGGER, dispatcher, updater, bot
from bot.config import BOT_TOKEN, OWNER_ID, GDRIVE_FOLDER_ID
from bot.decorators import is_authorised, is_owner
from telegram.error... | 2.171875 | 2 |
src/pyfinlab/risk_models.py | AnaSan27/pyfinlab | 1 | 7754 | <reponame>AnaSan27/pyfinlab<gh_stars>1-10
import pandas as pd
import numpy as np
from portfoliolab.utils import RiskMetrics
from portfoliolab.estimators import RiskEstimators
from pypfopt import risk_models as risk_models_
"""
Available covariance risk models in PortfolioLab library.
https://hudson-and-thames-portfol... | 2.453125 | 2 |
gaussian_blur/gaussian_blur.py | Soft-illusion/ComputerVision | 0 | 7755 | <reponame>Soft-illusion/ComputerVision
import cv2 as cv
import sys
import numpy as np
import random as r
import os
from PIL import Image as im
def noisy(noise_typ,image):
if noise_typ == "gauss":
# Generate Gaussian noise
gauss = np.random.normal(0,1,image.size)
print(gauss)
gauss ... | 2.71875 | 3 |
citywok_ms/employee/routes.py | fossabot/CityWok-Manager | 0 | 7756 | <reponame>fossabot/CityWok-Manager
from citywok_ms.file.models import EmployeeFile, File
import citywok_ms.employee.messages as employee_msg
import citywok_ms.file.messages as file_msg
from citywok_ms.employee.forms import EmployeeForm
from citywok_ms.file.forms import FileForm
from flask import Blueprint, flash, redir... | 2.140625 | 2 |
kitsune/customercare/cron.py | safwanrahman/Ford | 1 | 7757 | import calendar
from datetime import datetime, timedelta
import json
import logging
import re
import rfc822
from django.conf import settings
from django.db.utils import IntegrityError
import cronjobs
from multidb.pinning import pin_this_thread
from statsd import statsd
from twython import Twython
from kitsune.custom... | 2.171875 | 2 |
setup.py | nrcmedia/pdfrw | 2 | 7758 | <reponame>nrcmedia/pdfrw
#!/usr/bin/env python
from distutils.core import setup
try:
import setuptools
except:
pass
setup(
name='pdfrw',
version='0.1',
description='PDF file reader/writer library',
long_description='''
pdfrw lets you read and write PDF files, including
compositing multiple pag... | 1.953125 | 2 |
checkAnnotation.py | ZZIDZZ/pytorch-ssd | 0 | 7759 | import argparse
import sys
import cv2
import os
import os.path as osp
import numpy as np
if sys.version_info[0] == 2:
import xml.etree.cElementTree as ET
else:
import xml.etree.ElementTree as ET
parser = argparse.ArgumentParser(
description='Single Shot MultiBox Detector ... | 2.515625 | 3 |
src/oci/identity_data_plane/models/password_reset_authentication_request.py | LaudateCorpus1/oci-python-sdk | 0 | 7760 | <gh_stars>0
# coding: utf-8
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.... | 2.421875 | 2 |
venv/lib/python3.7/site-packages/convertdate/dublin.py | vchiapaikeo/prophet | 0 | 7761 | <filename>venv/lib/python3.7/site-packages/convertdate/dublin.py
# -*- coding: utf-8 -*-
# This file is part of convertdate.
# http://github.com/fitnr/convertdate
# Licensed under the MIT license:
# http://opensource.org/licenses/MIT
# Copyright (c) 2016, fitnr <<EMAIL>>
'''Convert to and from the Dublin day count''... | 2.375 | 2 |
tests/functional/controllers/test_group_controller_superuser.py | roscisz/TensorHive | 129 | 7762 | <filename>tests/functional/controllers/test_group_controller_superuser.py<gh_stars>100-1000
from tensorhive.models.Group import Group
from fixtures.controllers import API_URI as BASE_URI, HEADERS
from http import HTTPStatus
from importlib import reload
import json
import auth_patcher
ENDPOINT = BASE_URI + '/groups'
... | 2.234375 | 2 |
code/generate_thought_vectors.py | midas-research/text2facegan | 23 | 7763 | <gh_stars>10-100
import os
from os.path import join, isfile
import re
import numpy as np
import pickle
import argparse
import skipthoughts
import h5py
def main():
parser = argparse.ArgumentParser()
#parser.add_argument('--caption_file', type=str, default='Data/sample_captions.txt',
# help='caption file')
p... | 2.546875 | 3 |
venv/Lib/site-packages/mcipc/rcon/response_types/difficulty.py | Svesnav2/Discord-Bot-Minecraft-server-status | 0 | 7764 | """Parsing responses from the difficulty command."""
from mcipc.rcon.functions import boolmap
__all__ = ['parse']
SET = 'The difficulty has been set to (\\w+)'
UNCHANGED = 'The difficulty did not change; it is already set to (\\w+)'
def parse(text: str) -> bool:
"""Parses a boolean value from the text
re... | 3.46875 | 3 |
eth/beacon/aggregation.py | Bhargavasomu/py-evm | 0 | 7765 | <filename>eth/beacon/aggregation.py
from typing import (
Iterable,
Tuple,
)
from cytoolz import (
pipe
)
from eth._utils import bls
from eth._utils.bitfield import (
set_voted,
)
from eth.beacon.enums import SignatureDomain
from eth.beacon.typing import (
BLSPubkey,
BLSSignature,
Bitfield,
... | 2.453125 | 2 |
src/server/bos/controllers/v1/components.py | Cray-HPE/bos | 1 | 7766 | <filename>src/server/bos/controllers/v1/components.py
# Copyright 2021 Hewlett Packard Enterprise Development LP
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, includi... | 1.953125 | 2 |
cracking_the_coding_interview_qs/10.4/find_x_in_listy_test.py | angelusualle/algorithms | 0 | 7767 | <filename>cracking_the_coding_interview_qs/10.4/find_x_in_listy_test.py
import unittest
from find_x_in_listy import find_x_in_listy, Listy
class Test_Case_Find_X_In_Listy(unittest.TestCase):
def test_case_find_x_in_listy(self):
listy = Listy(list(range(0, 1*10**8)))
self.assertEqual(find_x_in_listy... | 3.203125 | 3 |
my_general_helpers.py | arminbahl/drosophila_phototaxis_paper | 0 | 7768 | <gh_stars>0
from scipy.signal import butter,filtfilt
from numba import jit
import bisect
def is_number_in_sorted_vector(sorted_vector, num):
index = bisect.bisect_left(sorted_vector, num)
return index != len(sorted_vector) and sorted_vector[index] == num
# def butter_lowpass(cutoff, fs, order=5):
# nyq =... | 2.640625 | 3 |
test/mitmproxy/addons/test_proxyserver.py | KarlParkinson/mitmproxy | 24,939 | 7769 | <reponame>KarlParkinson/mitmproxy
import asyncio
from contextlib import asynccontextmanager
import pytest
from mitmproxy import exceptions
from mitmproxy.addons.proxyserver import Proxyserver
from mitmproxy.connection import Address
from mitmproxy.proxy import layers, server_hooks
from mitmproxy.proxy.layers.http imp... | 2.0625 | 2 |
tensorflow_probability/python/distributions/masked.py | mederrata/probability | 1 | 7770 | <reponame>mederrata/probability
# Copyright 2021 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unl... | 1.742188 | 2 |
download.py | kaija/taiwan_stockloader | 2 | 7771 | import datetime
import httplib
import urllib
from datetime import timedelta
#now = datetime.datetime.now();
#today = now.strftime('%Y-%m-%d')
#print today
def isfloat(value):
try:
float(value)
return True
except ValueError:
return False
def convfloat(value):
try:
return float(value)
except ValueError:
... | 3.234375 | 3 |
heuristic/improvement/reopt/disruption_updater.py | annalunde/master | 1 | 7772 | <filename>heuristic/improvement/reopt/disruption_updater.py<gh_stars>1-10
import copy
import pandas as pd
from decouple import config
from heuristic.construction.construction import ConstructionHeuristic
from config.construction_config import *
from simulation.simulator import Simulator
from heuristic.improvement.reopt... | 2.21875 | 2 |
evennia/scripts/migrations/0013_auto_20191025_0831.py | Jaykingamez/evennia | 1,544 | 7773 | # Generated by Django 2.2.6 on 2019-10-25 12:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("scripts", "0012_auto_20190128_1820")]
operations = [
migrations.AlterField(
model_name="scriptdb",
name="db_typeclass_path",
... | 1.8125 | 2 |
tests/test_pyqrcodeng_issue13.py | dbajar/segno | 254 | 7774 | # -*- coding: utf-8 -*-
#
# Copyright (c) 2016 - 2020 -- <NAME>
# All rights reserved.
#
# License: BSD License
#
"""\
Test against issue <https://github.com/pyqrcode/pyqrcodeNG/pull/13/>.
The initial test was created by Mathieu <https://github.com/albatros69>,
see the above mentioned pull request.
Adapted for Segno ... | 1.617188 | 2 |
qiskit/quantum_info/operators/__init__.py | jagunnels/qiskit-sdk-py | 0 | 7775 | # -*- coding: utf-8 -*-
# Copyright 2019, IBM.
#
# This source code is licensed under the Apache License, Version 2.0 found in
# the LICENSE.txt file in the root directory of this source tree.
"""Quantum Operators."""
from .operator import Operator
from .unitary import Unitary
from .pauli import Pauli, pauli_group
f... | 1.273438 | 1 |
iocms/iocms/urls.py | Gaurav-Zaiswal/iw-acad-iocms-be | 0 | 7776 | <gh_stars>0
from django.contrib import admin
from django.urls import include, path
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
path('admin/', admin.site.urls),
path('class/', include('classroom.urls')),
path('assignment-api/', include('assignment.urls', names... | 1.835938 | 2 |
src/security/__init__.py | slippers/blogging_security_flatpage | 1 | 7777 | from src import app, db
from .models import User, Role, RoleUsers
from .security_admin import UserAdmin, RoleAdmin
from flask_security import Security, SQLAlchemyUserDatastore, \
login_required, roles_accepted
from flask_security.utils import encrypt_password
def config_security_admin(admin):
admin.add_view(U... | 3.09375 | 3 |
usaspending_api/download/lookups.py | lenjonemcse/usaspending-api | 1 | 7778 | <filename>usaspending_api/download/lookups.py<gh_stars>1-10
"""
This file defines a series of constants that represent the values used in
the API's "helper" tables.
Rather than define the values in the db setup scripts and then make db calls to
lookup the surrogate keys, we'll define everything here, in a file that ca... | 1.65625 | 2 |
python/modules/mysql_server.py | 91-jinrong/-91_monitor | 1 | 7779 | <filename>python/modules/mysql_server.py
#!/bin/env python
#-*-coding:utf-8-*-
import os
import sys
import string
import time
import datetime
import MySQLdb
class MySQL:
def __int__(self,host,port,user,passwd,dbname,timeout,charset):
self.host = host
self.port = port
self.user = user
... | 3.03125 | 3 |
Ethan File/Carrentsystem/Carrentsystem/test.py | hklhfong/Car-Rental-System | 0 | 7780 | <filename>Ethan File/Carrentsystem/Carrentsystem/test.py
import sqlite3
conn = sqlite3.connect("db")
cur = conn.cursor()
cur.execute("select * from CAR_ID limit 5;")
results = cur.fetchall()
print(results)
| 2.890625 | 3 |
tests/integration/hub_usage/dummyhub_slow/__init__.py | abreu4/jina | 2 | 7781 | import time
from jina.executors.crafters import BaseCrafter
from .helper import foo
class DummyHubExecutorSlow(BaseCrafter):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
time.sleep(15)
foo()
| 2.0625 | 2 |
src/evaluation_utils.py | philipp-hess/deep-learning-for-heavy-rainfall | 0 | 7782 | import numpy as np
import pandas as pd
from scipy.stats import spearmanr
from sklearn.metrics import f1_score, precision_score, recall_score
from IPython.display import display, clear_output
from sklearn.metrics import confusion_matrix
import scipy.stats as st
def continuous_to_categorical_with_quantiles(data: np.nda... | 2.859375 | 3 |
poloniex_apis/api_models/deposit_withdrawal_history.py | xJuggl3r/anapolo | 0 | 7783 | <filename>poloniex_apis/api_models/deposit_withdrawal_history.py<gh_stars>0
from collections import defaultdict
from poloniex_apis.api_models.ticker_price import TickerData
class DWHistory:
def __init__(self, history):
self.withdrawals = defaultdict(float)
self.deposits = defaultdict(float)
... | 2.765625 | 3 |
app/handler.py | vnrag/aws-pipeline-dashboard | 0 | 7784 | from datetime import datetime,timezone
import sys
import boto3
import json
def pipeline_event(event, context):
state = get_final_state(event)
if state is None:
return
event_time = datetime.strptime(event['time'], '%Y-%m-%dT%H:%M:%SZ').replace(tzinfo=timezone.utc)
metric_data = []
if eve... | 2.21875 | 2 |
cogs/commands.py | sudo-do/discord-chatbot | 1 | 7785 | <filename>cogs/commands.py
import discord
import sqlite3
from discord.ext import commands
conn= sqlite3.connect("dbs/main.db")
class Commands(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
@commands.cooldown(1, 30, commands.BucketType.guild)
@commands.has_permissions(manage_channels... | 3.109375 | 3 |
poetry/console/commands/self/update.py | mgasner/poetry | 0 | 7786 | <reponame>mgasner/poetry<gh_stars>0
import hashlib
import os
import shutil
import subprocess
import sys
import tarfile
from functools import cmp_to_key
from gzip import GzipFile
try:
from urllib.error import HTTPError
from urllib.request import urlopen
except ImportError:
from urllib2 import HTTPError
... | 2.140625 | 2 |
osp/test/corpus/syllabus/test_text.py | davidmcclure/open-syllabus-project | 220 | 7787 | <reponame>davidmcclure/open-syllabus-project<gh_stars>100-1000
from osp.corpus.syllabus import Syllabus
from osp.test.utils import requires_tika
def test_empty(mock_osp):
"""
Should return None if the file is empty.
"""
path = mock_osp.add_file(content='', ftype='plain')
syllabus = Syllabus(pa... | 2.703125 | 3 |
boa_test/tests/test_ico_template.py | mixbee/neo-boa | 4 | 7788 | <reponame>mixbee/neo-boa
from boa_test.tests.boa_test import BoaFixtureTest
from boa.compiler import Compiler
from neo.Core.TX.Transaction import Transaction
from neo.Prompt.Commands.BuildNRun import TestBuild
from neo.EventHub import events
from neo.SmartContract.SmartContractEvent import SmartContractEvent, NotifyEve... | 1.648438 | 2 |
regexem.py | lvijay/ilc | 1 | 7789 | <filename>regexem.py
#!/usr/bin/python
# -*- mode: python; -*-
## This file is part of Indian Language Converter
## Copyright (C) 2006 <NAME> <<EMAIL>>
## Indian Language Converter is free software; you can redistribute it
## and/or modify it under the terms of the GNU General Public License
## as published by the F... | 3.625 | 4 |
main.py | rohit-k-das/crowdstrike-alerts | 3 | 7790 | import requests
import crowdstrike_detection as crowdstrike
import logging
import click
import urllib.parse
import ConfigParser
import os
logging.basicConfig(level=logging.INFO, format='%(asctime)s %(name)-15s [%(levelname)-8s]: %(message)s',
datefmt='%m/%d/%Y %I:%M:%S %p')
logger = logging.get... | 2.34375 | 2 |
connexion/http_facts.py | lumikanta/connexion | 0 | 7791 | <filename>connexion/http_facts.py
FORM_CONTENT_TYPES = [
'application/x-www-form-urlencoded',
'multipart/form-data'
]
| 1.117188 | 1 |
Test3/yandexAPI3.py | klepik1990/YandexTestAPI | 0 | 7792 | import requests
import json
HEADERS = {"Authorization": "OAuth <KEY>", "Accept": "*/*"}
URL = "https://cloud-api.yandex.net:443/v1/disk/"
def get_folder_info(folder_name_1, folder_name_2, url=None, headers=None):
"""Получение информации о статусе папок на диске
Args:
folder_name_1: имя корневой пап... | 3 | 3 |
app/users/operator/views.py | trinanda/AQUR | 0 | 7793 | import os
from collections import defaultdict
from flask import render_template
from flask_login import login_required
from sqlalchemy import and_
from app import db
from app.decorators import operator_required
from app.models import Student, MonthNameList, Course, PaymentStatus, Payment, Teacher, Schedule
from app.u... | 2.609375 | 3 |
arvet/core/metric.py | jskinn/arvet | 2 | 7794 | <gh_stars>1-10
# Copyright (c) 2017, <NAME>
import abc
import typing
import bson
import pymodm
import pymodm.fields as fields
import arvet.database.pymodm_abc as pymodm_abc
from arvet.database.reference_list_field import ReferenceListField
import arvet.core.trial_result
class Metric(pymodm.MongoModel, metaclass=pymod... | 2.359375 | 2 |
pfile/accessor.py | thorwhalen/ut | 4 | 7795 | <filename>pfile/accessor.py
"""File access utils"""
__author__ = 'thorwhalen'
# from ut.datapath import datapath
import pickle
import os
from ut.util.importing import get_environment_variable
import pandas as pd
import ut.pfile.to as file_to
import ut.pfile.name as pfile_name
import ut.pstr.to as pstr_to
from ut.seria... | 2.265625 | 2 |
scripts/statistics.py | cstenkamp/MastersThesisText | 0 | 7796 | <filename>scripts/statistics.py
import subprocess
import git
from os.path import dirname, join, abspath
import pandas as pd
from matplotlib import pyplot as plt
import requests
import io
import zipfile
import tempfile
from datetime import timedelta
FILENAME = join(dirname(__file__), "..", "thesis.tex")
DISP_PAGESMAX ... | 2.515625 | 3 |
setup.py | TheFraserLab/enrich_pvalues | 1 | 7797 | <gh_stars>1-10
"""Installation instructions for enrich_pvalues."""
import os
from setuptools import setup
import enrich_pvalues # For version
VERSION=enrich_pvalues.__version__
GITHUB='https://github.com/MikeDacre/enrich_pvalues'
with open('requirements.txt') as fin:
REQUIREMENTS = [
i[0] for i in [j.sp... | 1.984375 | 2 |
homeschool/students/tests/test_forms.py | brandonmcclure/homeschool | 0 | 7798 | import datetime
from homeschool.courses.tests.factories import (
CourseFactory,
CourseTaskFactory,
GradedWorkFactory,
)
from homeschool.schools.tests.factories import GradeLevelFactory
from homeschool.students.forms import CourseworkForm, EnrollmentForm, GradeForm
from homeschool.students.models import Cou... | 2.8125 | 3 |
Mining_Projects/getAllProjects_Parallel.py | ai-se/heroes_compsci | 0 | 7799 | """ @Author Jchakra"""
""" This code is to download project information using GitHub API (Following Amrit's Hero paper criteria of how to find good projects) """
from multiprocessing import Process,Lock
import time
import json
import requests
## Downloading all the projects
def func1():
repo_result = []
To... | 3.125 | 3 |