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 |
|---|---|---|---|---|---|---|
history/migrations/0005_auto_20190411_2258.py | hereischen/Goliath | 5 | 46900 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-04-11 22:58
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('history', '0004_history_prev_quantity'),
]
operations = [
m... | 1.414063 | 1 |
stereomideval/test_exceptions.py | i3drobotics/StereoMiddleburyEval | 2 | 46901 | """This module tests Exceptions functionality in stereomideval module"""
import pytest
import numpy as np
from stereomideval.dataset import Dataset
from stereomideval.exceptions import ImageSizeNotEqual, PathNotFound, InvalidSceneName
def test_catch_invalid_image_sizes():
"""Test catching invalid image sizes"""
... | 2.921875 | 3 |
Diskmag/sources/mag.py | w84death/rpii-fdd-mag | 0 | 46902 | <filename>Diskmag/sources/mag.py
#
# Nomad Diskmag - Mag class
# Main loop and app initiation.
#
# E-zine on a 1.44 floppy tailored made on Raspberry Pi computer.
# Created by <NAME>
# https://krzysztofjankowski.com/nomad-diskmag
#
import pygame
from pygame.locals import *
from sources.chapter import Chapter
from sour... | 2.375 | 2 |
applications/cpfecys/controllers/default.py | SIMBitGt-Company/RepoRepo | 0 | 46903 | <filename>applications/cpfecys/controllers/default.py<gh_stars>0
# -*- coding: utf-8 -*-
# this file is released under public domain and you can use without limitations
#########################################################################
## This is a sample controller
## - index is the default action of any appli... | 2.21875 | 2 |
ice_validator/tests/test_network_format.py | tlovett/vvp-validation-scripts | 0 | 46904 | # -*- coding: utf8 -*-
# ============LICENSE_START=======================================================
# org.onap.vvp/validation-scripts
# ===================================================================
# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
# ========================================... | 1.28125 | 1 |
server/huTools/couch.py | jeffjia/Send2Cloud | 1 | 46905 | <filename>server/huTools/couch.py<gh_stars>1-10
#!/usr/bin/env python
# encoding: utf-8
"""
couch.py
Created by <NAME> on 2010-02-26.
Copyright (c) 2010 HUDORA GmbH. All rights reserved.
"""
import couchdb.client
import warnings
def setup_couchdb(servername, database):
"""Get a connection handler to the CouchDB ... | 1.898438 | 2 |
app/mixins.py | valentinDruzhinin/todo-lists | 0 | 46906 | import json
from bson import ObjectId
from pymongo import ReturnDocument
from .exceptions import DBException
class DBActionsMixin:
def __init__(self, model, db):
self._model_cls = model
self._db = db
def add(self, item):
db_obj = self._collection.insert_one(item.prepare_for_db())
... | 2.40625 | 2 |
training/utils/divide_data.py | liecn/Oort | 43 | 46907 | # -*- coding: utf-8 -*-
from random import Random
#from core.dataloader import DataLoader
from torch.utils.data import DataLoader
import numpy as np
from math import *
import logging
from scipy import stats
import numpy as np
from pyemd import emd
from collections import OrderedDict
import time
import pickle, random
fr... | 2.265625 | 2 |
demo.py | re-treat/DialoFlow | 0 | 46908 | <filename>demo.py<gh_stars>0
from generate import *
history = []
while True:
new_sentence = input('>> User: ').replace('\n','')
history.append(new_sentence)
resps = get_responses(history[-5:],mode='sample')
best_resp = resps[0]
print(">> Bot:",best_resp)
history.append(best_resp) | 2.71875 | 3 |
tests/pyposmat/engines/PyposmatEngine/dev__Ni_eam__born_exp_rose/dev__PyposmatEngine__eam_Ni.py | eragasa/pypospack | 4 | 46909 | import os
import shutil
import Ni__eam__born_exp_rose as configuration
from collections import OrderedDict
def cleanup_simulation_directories():
sim_directories = [
'Ni_fcc_vac.lmps_min_pos',
'Ni_fcc.lmps_elastic',
'Ni_fcc_100_unit.lmps_min_all',
'Ni_fcc_111_s.lmps_min_pos',
... | 1.992188 | 2 |
dash-cytoscape/cyto-edit-graph.py | anhinga/2019-python-drafts | 4 | 46910 | <reponame>anhinga/2019-python-drafts<filename>dash-cytoscape/cyto-edit-graph.py
# based on cyto-multiselect-callback.py
# added ability to add nodes and edges
# + experiments with styling
# + logging (but not enough to conveniently store changes between sessions)
#import json
import datetime
print("START")
with ope... | 2.234375 | 2 |
timesearch_modules/get_styles.py | clayne/timesearch | 127 | 46911 | <filename>timesearch_modules/get_styles.py
import os
import requests
from . import common
from . import tsdb
session = requests.Session()
def get_styles(subreddit):
(database, subreddit) = tsdb.TSDB.for_subreddit(subreddit, fix_name=True)
print('Getting styles for /r/%s' % subreddit)
subreddit = common.... | 2.609375 | 3 |
stade/core/admin/challenge.py | ImageMarkup/stade | 4 | 46912 | from django.contrib import admin
from stade.core.models import Challenge
from .task import TaskInline
@admin.register(Challenge)
class ChallengeAdmin(admin.ModelAdmin):
inlines = [TaskInline]
| 1.578125 | 2 |
isovar/read_collector.py | openvax/isovar | 12 | 46913 | <gh_stars>10-100
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# dis... | 2 | 2 |
py/problem_059.py | curtislb/ProjectEuler | 0 | 46914 | #!/usr/bin/env python3
"""problem_059.py
Problem 59: XOR decryption
Each character on a computer is assigned a unique code and the preferred
standard is ASCII (American Standard Code for Information Interchange). For
example, uppercase A = 65, asterisk (*) = 42, and lowercase k = 107.
A modern encryption method is ... | 4.375 | 4 |
app/model/__init__.py | wax911/insomnia-graphql-generator | 7 | 46915 | from app.model.basic import *
| 1.117188 | 1 |
tests/o3_test.py | sophiaas/e3nn | 1 | 46916 | <reponame>sophiaas/e3nn
# pylint: disable=not-callable, no-member, invalid-name, line-too-long, wildcard-import, unused-wildcard-import, missing-docstring, no-value-for-parameter
import unittest
from functools import partial
import torch
from e3nn import o3
class Tests(unittest.TestCase):
def test_irrep_closur... | 2.15625 | 2 |
test/app/api/query/test_common.py | awaisali88/Python-Flask-mongo | 3 | 46917 | <gh_stars>1-10
import pytest
from app.api.business.common import _validate_objectid
class TestCommon:
def test_if_valid_object_id(self):
_validate_objectid("5f960d555042a76847bfa0c8")
def test_if_invalid_object_id(self):
with pytest.raises(Exception):
_validate_objectid("fuba")
| 2.171875 | 2 |
LeetCode/Python3/BackTracking/351. Android Unlock Patterns.py | WatsonWangZh/CodingPractice | 11 | 46918 | <gh_stars>10-100
# Given an Android 3x3 key lock screen and two integers m and n,
# where 1 ≤ m ≤ n ≤ 9, count the total number of unlock patterns of the Android lock screen,
# which consist of minimum of m keys and maximum n keys.
# Rules for a valid pattern:
# Each pattern must connect at least m keys and at most ... | 3.75 | 4 |
video_capture/plotting.py | FrostyDesigner/Python_Scripts | 1 | 46919 | <reponame>FrostyDesigner/Python_Scripts
from motion_capture import df
from bokeh.plotting import figure, show, output_file
from bokeh.models import HoverTool, ColumnDataSource
#convert start and end columns to strings for easy reading
df["Start_string"]=df["Start"].dt.strftime("%Y-%m-%d %H:%M:%S")
df["End_string"]=df[... | 2.625 | 3 |
code_test.py | wanglikun1973/CrIS_VIIRS_collocation | 1 | 46920 | import numpy as np
import glob
import geo
import time
import pdb
start_time = time.time()
dataDir='./data/'
# get CrIS files
cris_sdr_files = sorted(glob.glob(dataDir+'SCRIS*'))
cris_geo_files = sorted(glob.glob(dataDir+'GCRSO*'))
# get VIIRS files
viirs_sdr_files = sorted(glob.glob(dataDir+'SVM15*'))
viirs_geo_f... | 2.203125 | 2 |
examples/search/aggregate_hosts.py | FantasqueX/censys-python | 1 | 46921 | """Aggregate hosts data set."""
from censys.search import SearchClient
c = SearchClient()
# The aggregate method constructs a report using a query, an aggregation field, and the
# number of buckets to bin.
report = c.v2.hosts.aggregate(
"service.service_name: HTTP",
"services.port",
num_buckets=5,
)
print... | 3.1875 | 3 |
riego/web/views/events.py | samibarasi/riego | 1 | 46922 | import aiohttp_jinja2
from aiohttp import web
from riego.db import get_db
from riego.web.security import raise_permission
router = web.RouteTableDef()
def setup_routes_events(app):
app.add_routes(router)
@router.get("/events", name='events')
@aiohttp_jinja2.template('events/index.html')
async... | 2.203125 | 2 |
pypcl/__init__.py | r9y9/pypcl | 0 | 46923 | # coding: utf-8
from __future__ import division, print_function, absolute_import
import pkg_resources
__version__ = pkg_resources.get_distribution('pypcl').version
from pypcl.common import *
| 1.25 | 1 |
share/when-wizard/plugins/fileops-opendir.py | almostearthling/when-wizard | 2 | 46924 | <reponame>almostearthling/when-wizard
# file: share/when-wizard/modules/fileops-openfile.py
# -*- coding: utf-8 -*-
#
# Task plugin to show a directory
# Copyright (c) 2015-2018 <NAME>
# Released under the BSD License (see LICENSE file)
import os
import locale
from plugin import TaskPlugin, PLUGIN_CONST, plugin_name
... | 2.390625 | 2 |
view/gameBoard/HistoryView.py | achrafJhidri/LeCompteEstBon | 0 | 46925 | import tkinter as tk
import tkinter.font as tkFont
class History(tk.Frame):
def __init__(self, master):
self.master=master
tk.Frame.__init__(self, master=master)
self.listOperations =[]
self.history = []
self.LEFT = 0
self.OP = 1
self.RIGHT = 2
self.E... | 3.046875 | 3 |
etl/steps/data/garden/owid/latest/key_indicators/table_population.py | owid/etl | 5 | 46926 | <reponame>owid/etl
#
# table_population.py
# key_indicators
#
"""
Adapted from Ed's importers script:
https://github.com/owid/importers/blob/master/population/etl.py
"""
from pathlib import Path
from typing import cast, List
import pandas as pd
from owid.catalog import Dataset, Table, Source
from etl.paths impor... | 2.375 | 2 |
lcr/data_gathering/optimal_compression.py | pinarda/lcr | 0 | 46927 | """
Contains the code necessary to extract a list of optimal compression values from a csv file containing
columns corresponding to {compression_type}_{level}, {variable}, {time}, and {DSSIM}
It would be best to open the csv file once, and get a list of all variables, levels, and timesteps
so I don't read the csv file... | 3.53125 | 4 |
qa327_test/frontend/test_logout_page.py | jacob-seiler/seetgeek | 0 | 46928 | <filename>qa327_test/frontend/test_logout_page.py
import pytest
from seleniumbase import BaseCase
from qa327_test.conftest import base_url
from unittest.mock import patch
from qa327.models import User
from werkzeug.security import generate_password_hash, check_password_hash
"""
This file defines all unit tests for th... | 2.765625 | 3 |
beyondtheadmin/clients/migrations/0014_auto_20210825_0854.py | gfavre/invoice-manager | 1 | 46929 | <filename>beyondtheadmin/clients/migrations/0014_auto_20210825_0854.py<gh_stars>1-10
# Generated by Django 3.1.7 on 2021-08-25 06:54
from django.db import migrations
import django_countries.fields
class Migration(migrations.Migration):
dependencies = [
('clients', '0013_auto_20210821_1503'),
]
... | 1.328125 | 1 |
Section_6/Exercise_11.py | Szymon-Budziak/WDI_exercises_solutions | 0 | 46930 | <filename>Section_6/Exercise_11.py
"""
Dana jest tablica T[N]. Proszę napisać program zliczający liczbę “enek” o określonym iloczynie.
"""
def number_of_ns(T, product, n, idx=0):
if product == 1 and n == 0:
return 1
if n == 0:
return 0
count = 0
for i in range(idx, len(T)):
if ... | 3.8125 | 4 |
loggers.py | IanVzs/WindWhisper | 2 | 46931 | <reponame>IanVzs/WindWhisper
import logging
import logging.config
logging.config.fileConfig('logging.ini')
# create wea logger
weatherLog = logging.getLogger('weatherLog')
debugLog = logging.getLogger('debugLog')
scheLog = logging.getLogger('scheLog')
| 1.632813 | 2 |
examples/models/plot_horsager2009.py | aiwenxu/pulse2percept | 0 | 46932 | # -*- coding: utf-8 -*-
"""
===============================================================================
Horsager et al. (2009): Predicting temporal sensitivity
===============================================================================
This example shows how to use the
:py:class:`~pulse2percept.models.Horsager... | 2.875 | 3 |
essaie_snippet/test_find_planet.py | Vahen/millenium_falcon_challenge | 0 | 46933 | <filename>essaie_snippet/test_find_planet.py
##planets = [
## {
## "planet": "Tatooine",
## "visited": False,
## "reachable": ["Dagobah", "Hoth"]
## },
## {
## "planet": "Dagobah",
## "visited": False,
## "reachable": ["Hoth", "Endor"]
## },
## {
## "plane... | 2.828125 | 3 |
thehardway/exts/ext10.py | abos5/pythontutor | 0 | 46934 | tabby_cat = "\tI'm tabbed in"
persian_cat = "I'm split\non a line."
backslash_cat = "I'm \\ a \\ cat."
fat_cat = """
I'll do a list:
\t\t* Cat food.
\t* Fishes.
\t\t\t* Catnip\n\t* Grass
"""
print tabby_cat
print persian_cat
print backslash_cat
print fat_cat
| 2.75 | 3 |
relational/populate-maria/populate-maria.py | eduardolfalcao/bigdata-unifacisa | 1 | 46935 | #!/usr/bin/python3
import mysql.connector
from mysql.connector import Error
from mysql.connector import errorcode
from os import environ
import json
DB_HOST = environ.get('DB_HOST')
DB_NAME = environ.get('DB_NAME')
DB_USER = environ.get('DB_USER')
DB_PASSWORD = environ.get('DB_PASSWORD')
if DB_PASSWORD is not None:
... | 2.578125 | 3 |
extra/graph/company_tree.py | lsbardel/mathfun | 0 | 46936 | <reponame>lsbardel/mathfun
from mathfun.graph.template import Graph
| 0.875 | 1 |
.circleci/build_recipes.py | gogetdata/ggd-recipes | 87 | 46937 | from __future__ import print_function
import argparse
import glob
import io
import os
import subprocess as sp
import sys
from collections import defaultdict
from itertools import chain
import networkx as nx
import requests
import yaml
from conda_build import api
# ----------------------------------------------------... | 1.84375 | 2 |
Illust.py | Armageddon-15/pixivpy | 0 | 46938 | <filename>Illust.py<gh_stars>0
from Parameters import *
import pixivpy3 as pixiv
import os
import pickle
import time
import re
import random
import requests
import shutil
import datetime
import imageio.v3 as iio
import zipfile
import queue
import threading
import math
import numpy as np
from typing import Union
path_... | 2.09375 | 2 |
ABC/abc101-abc150/abc117/c.py | KATO-Hiro/AtCoder | 2 | 46939 | <filename>ABC/abc101-abc150/abc117/c.py
# -*- coding: utf-8 -*-
def main():
n, m = map(int, input().split())
xs = sorted(list(map(int, input().split())))
if n >= m:
print(0)
else:
ans = xs[-1] - xs[0]
diff = [0 for _ in range(m - 1)]
for i in range(m - 1)... | 3.15625 | 3 |
corehq/motech/dhis2/tests/test_tasks.py | akashkj/commcare-hq | 471 | 46940 | from django.test import TestCase
from corehq import toggles
from corehq.motech.dhis2.tasks import send_datasets_for_all_domains
class TestSendDatasetsForAllDomains(TestCase):
domain_name = 'does-not-exist'
def setUp(self):
toggles.DHIS2_INTEGRATION.set(
self.domain_name,
ena... | 2.15625 | 2 |
AlphaGoZero/code/UI/UI.py | OoSnowfxm/AlphaZero_Othello | 0 | 46941 | '''
@Author: fxm
@Date: Dec 27, 2020.
@Title: UI class.
'''
import sys
sys.path.append('..')
import pygame
import logging
from pygame.locals import *
import pygame.gfxdraw
from collections import namedtuple
from Framework.Net import dotdict
from Othello.Board import Board
log = logging.getLogger(__name__)
... | 2.6875 | 3 |
src/django_opt_out/plugins/sparkpost/views.py | fossabot/django-opt-out | 0 | 46942 | <gh_stars>0
# coding=utf-8
import json
import logging
from django.http import HttpResponse
from django.utils.decorators import method_decorator
from django.views import View
from django.views.decorators.csrf import csrf_exempt
from . import signals
from ...signals import send_signal
log = logging.getLogger(__name__)... | 1.890625 | 2 |
hooks/relations/bind-rndc/requires.py | Boolman/designate | 0 | 46943 | <gh_stars>0
#!/usr/bin/python
#
# Copyright 2016 Canonical 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 applic... | 2.15625 | 2 |
mount_point_checker.py | light-bringer/mount-point-verifier | 0 | 46944 | <gh_stars>0
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
PROGRAM : mount_point_checker.py
PyVersion : Python 2.7
This module takes multiple mount paths and compares them after backup
The module has 2 modes : Backup (-b) and Verify (-v)
Input Params :
-m <mount_points> All the mount point data that need to be... | 3.015625 | 3 |
handlers/account.py | zhy0216-collection/Gather | 0 | 46945 | # coding=utf-8
import time
import hashlib
import tornado.web
import tornado.locale
from bson.objectid import ObjectId
from . import BaseHandler
from .utils import username_validator, email_validator
class SignupHandler(BaseHandler):
def get(self):
if self.current_user:
self.redirect(self.get_... | 2.25 | 2 |
main.py | sajidengg/tets | 1 | 46946 | # -*- coding: UTF-8 -*-
# main.py
# Root file for EmotionDetection program.
# Prints out command line menu and handles user choices
from __future__ import print_function
from EmotionDetection import WordMap
from EmotionDetection import EvaluateText
from EmotionDetection import GUI
try:
input = raw_input
except N... | 3.75 | 4 |
python/cmd/print_tables.py | yousero/scrape | 0 | 46947 | import os
def print_tables(tables, width=os.get_terminal_size().columns, spaces=3, index_width=3):
space = ' ' * spaces
lines = []
if index_width <= 0:
index_width = -1
tables.sort(key=lambda t: max(len(t), max([len(r) for r in t])), reverse=True)
for table in tables:
max_length = max([len(x) f... | 2.921875 | 3 |
uploader/database/database_utils.py | umed/xl2pgtable | 4 | 46948 | import datetime as dt
from uploader.utils import NULL
from typing import List
__ESCAPE_SYMBOLS_MAPPING = {"'": r"''"}
def __value_empty(value) -> bool:
return value == NULL or value is None or not value or (isinstance(value, str) and value.isspace())
def __escaped_symbols() -> dict:
if not hasattr(__escape... | 2.828125 | 3 |
main.py | upkodah/upkodah-service | 0 | 46949 | import destination_search
'''
test용 값
gpsX = 127.0816985 # 동경 - 경도
gpsY = 37.5642135 # 북위 - 위도
time = 20
1. 좌표, 시간 입력 -> 주변 버스 정류소 ID 반환
2. 정류소 ID 입력 -> 버스 노선 획득
3. 획득한 버스 노선에서 출발지, 목적지 시간 계산하여 도착 버스 정류장 반환
'''
print("gps_x : ", end='')
gps_x = input()
print("gps_y : ", end='')
gps_y = input()
print("t... | 3.640625 | 4 |
src/predict-algae-species/core/dataloader.py | mahyar-osn/predict-algae-species | 0 | 46950 | from torch.utils.data import Dataset
import cv2
class SegmentationDataSet(Dataset):
def __init__(self, image_paths, mask_paths, transform):
self.image_paths = image_paths
self.mask_paths = mask_paths
self.transforms = transform
def __len__(self):
return len(self.image_paths)
... | 3.109375 | 3 |
hdl21/elab.py | dan-fritchman/Hdl21 | 1 | 46951 | <gh_stars>1-10
"""
# hdl21 Elaboration
Defines the primary `elaborate` method used to flesh out an in-memory `Module` or `Generator`.
Internally defines and uses a number of hierarchical visitor-classes which traverse the hardware hierarchy,
performing one or more transformation-passes.
"""
# Std-Lib Imports
imp... | 2.59375 | 3 |
odoo-13.0/addons/account/wizard/account_accrual_accounting.py | VaibhavBhujade/Blockchain-ERP-interoperability | 0 | 46952 | # -*- coding: utf-8 -*-
from odoo import api, fields, models, _
from odoo.exceptions import UserError
from odoo.tools.misc import format_date
class AccrualAccountingWizard(models.TransientModel):
_name = 'account.accrual.accounting.wizard'
_description = 'Create accrual entry.'
date = fields.Date(require... | 1.929688 | 2 |
test.py | minizon/Mask_RCNN_KP | 1 | 46953 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 11 21:22:59 2018
@author: pami4
"""
#CUDA_VISIBLE_DEVICES=0 python
from pycocotools.coco import COCO
import coco
import numpy as np
from matplotlib import pyplot as plt
import visualize
import custom_utils
config = coco.CocoConfig()
config.GPU_CO... | 1.8125 | 2 |
src/x_mlps/_version.py | PyriteAI/x-mlps | 4 | 46954 | from importlib.metadata import PackageNotFoundError, version
try:
__version__ = version("x_mlps")
except PackageNotFoundError:
# package is not installed
__version__ = None
| 1.5625 | 2 |
company/signals/handlers.py | OnGridSystems/RobotVeraWebApp | 11 | 46955 | from django.db.models.signals import post_save
from django.dispatch import receiver
from company.models import Company
from company.tasks import deploy_new_company
@receiver(post_save, sender=Company)
def company_created(sender, instance, created, **kwargs):
if created:
deploy_new_company.delay(instance.... | 1.914063 | 2 |
libs/gen_shop.py | a1ex4/ownfoil | 7 | 46956 | <filename>libs/gen_shop.py
# Usage:
# python gen_shop.py <directory to scan>
# Generate a 'shop.tfl' Tinfoil index file
# as well as 'shop.json', same content but viewable in the browser
import os, json, sys, time
from consts import *
from jsonc_parser.parser import JsoncParser
import logging
logging.basicConfig(form... | 2.703125 | 3 |
tech_project/lib/python2.7/site-packages/aldryn_common/timesince.py | priyamshah112/Project-Descripton-Blog | 2 | 46957 | <reponame>priyamshah112/Project-Descripton-Blog
import datetime
from django.utils.timezone import is_aware, utc
from django.utils.translation import ugettext, ungettext
def timesince_data(d, now=None, reverse=False):
"""
Takes two datetime objects and returns the time between d and now
as a list of compo... | 2.765625 | 3 |
ratemap_lib.py | bartulem/KISN-pancortical-kinematics | 2 | 46958 | <filename>ratemap_lib.py
"""
Calculates ratemaps.
@author: <NAME>
@modified: JingyiGF
"""
import matplotlib
from scipy import *
import scipy.linalg as linalg
import scipy.ndimage.filters
import scipy.io
import numpy as np
import math
import copy as copycopy
import pickle
from scipy.optimize import minimize
import mat... | 2.296875 | 2 |
tests/test1.py | BykovDmitrii/rubymine-is2018 | 1 | 46959 | if True:
pass
if 0:
pass
if 1:
pass
if (1==1) :
pass
if 1 == 2 + - 1 :
pass
if 456 == 244:
pass
if 1 == 0 - 5 + 6 - 1:
pass
if 2 + 2 == 5:
pass
if 23313 + 31313 == 0:
pass
if 2 + 2 == 3 + 1 * 0 + 1 :
pass
if 1 == 1:
pass
if - 1== 2-3 :
pass
if (2 + 2) + 2 == 7:
... | 2.578125 | 3 |
src/samples/lists02.py | comcy/python-basics | 0 | 46960 | # lists02.py
def test_list_01():
# Tuples: immutable
t1 = (1, 2, 3)
print(t1, type(t1))
# Lists: immutable
l1 = [1, 2, 3]
print(l1, type(l1))
t2 = t1
l2 = l1
# Kopie, Clone erzeugen
l2 = list(l1) # Neue Liste mit den Elementen aus l1
l3 = l1.copy()
t2 = t2 + (4, )... | 3.890625 | 4 |
cocutils/pathutils.py | zhs007/cocutils | 0 | 46961 | # -*- coding:utf-8 -*-
from sc import SupercellSWF
import os
def findAllFile(basePath, endsWith):
for root, ds, fs in os.walk(basePath):
for f in fs:
if not f.startswith('.') and f.endswith(endsWith):
fullname = os.path.join(root, f)
yield fullname
| 2.765625 | 3 |
Chapter_8/regexFileSearch.py | TravisLeeWolf/ATBS | 0 | 46962 | <reponame>TravisLeeWolf/ATBS
#! python3
# regexFileSearch.py - Opens all .txt files in a folder and searches for any matching line
# The results are printed to the screen | 2.171875 | 2 |
madgraph_plugin/__init__.py | simonthor/madflow | 6 | 46963 | #####################################################
# #
# Source file of the MadFlow plugin #
# Use only with consent of its authors. #
# #
# authors: S.Carrazza, J.Cruz-Martinez, ... | 2.25 | 2 |
dubdub/interpreter.py | RLToolsWorkshop/tunnel-arrow | 0 | 46964 | import abc
import time
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, List, Optional, cast
from loguru import logger
from rich import print
from dubdub import (
Binary,
Grouping,
Literal,
Node,
Token,
TokenType,
Unary,
Visitor,
dataclass,
)
fro... | 2.46875 | 2 |
tests/data/expected/main/multiple_files_self_ref_single/output.py | adaamz/datamodel-code-generator | 891 | 46965 | <reponame>adaamz/datamodel-code-generator
# generated by datamodel-codegen:
# filename: test.json
# timestamp: 2019-07-26T00:00:00+00:00
from __future__ import annotations
from pydantic import BaseModel, Field
class Second(BaseModel):
__root__: str
class First(BaseModel):
__root__: Second
class Mod... | 2.296875 | 2 |
mz_alerts/pagerduty-client/pd_client.py | dunithd/edu-samples | 9 | 46966 | from pdpyras import APISession
from requests.sessions import session
from kafka import KafkaConsumer
import json
import sys
print("Starting the alerts listener")
# Kafka configurations
kafka_broker = 'kafka:9092'
alerts_topic = "high-temp-alerts-u5-1631586083-13100517045407420899"
# PageDuty configurations
api_token... | 2.703125 | 3 |
SearchingAlgorithms/LinearSearch.py | Sai-nook73/TheAlgorithms | 1 | 46967 | <filename>SearchingAlgorithms/LinearSearch.py
def linearSearch(collection, target):
for i in range(0, len(collection)):
if collection[i] == target:
return i
return -1
def visualization():
from random import randint
length = 10
collection = [randint(0, length) for i in range(0, length)]
target = randint(0, l... | 3.953125 | 4 |
tests/test_profitable_music_genre.py | swimmio/sqlalchemy_swimm | 0 | 46968 | from decimal import Decimal
from src import profitable_music_genre
EXPECTED_RESULT = [
(Decimal('826.65'), 'Rock'),
(Decimal('382.14'), 'Latin'),
(Decimal('261.36'), 'Metal'),
(Decimal('241.56'), 'Alternative & Punk'),
(Decimal('93.53'), 'TV Shows'),
(Decimal('79.20'), 'Jazz'),
(Decimal('6... | 2.5 | 2 |
source/_sample/mpl/tex.py | showa-yojyo/notebook | 14 | 46969 | <reponame>showa-yojyo/notebook<filename>source/_sample/mpl/tex.py<gh_stars>10-100
#!/usr/bin/env python
"""tex.py: Demonstrate how to use TeX notation in Matplotlib.
You can obtain the original script file from:
From http://matplotlib.org/mpl_examples/statistics/histogram_demo_features.py
"""
from numpy.random import ... | 3.078125 | 3 |
excercises /exc/database.py | Data-Science-East-AFrica/Introduction--To--Python | 5 | 46970 | <reponame>Data-Science-East-AFrica/Introduction--To--Python
from flask import Flask, render_template, request
from flaskext.mysql import MySQL
app = Flask(__name__)
app.config['MYSQL_HOST'] = 'localhost'
app.config['MYSQL_USER'] = 'root'
app.config['MYSQL_PASSWORD'] = '<PASSWORD>'
app.config['MYSQL_DB'] = 'MyDB'
m... | 3.25 | 3 |
utils.py | fgerzer/l2rpn_parallel_training | 0 | 46971 | import multiprocessing as mp
import os
import queue
import signal
import torch
class BaseCallback:
def __init__(self, verbose: int = 0):
self.model = None
self.verbose = verbose
def init_callback(self, model):
self.model = model
def on_training_start(self):
pass
def ... | 2.359375 | 2 |
country/migrations/0023_auto_20210301_0839.py | bikramtuladhar/covid-19-procurement-explorer-admin | 0 | 46972 | <filename>country/migrations/0023_auto_20210301_0839.py
# Generated by Django 3.1.2 on 2021-03-01 08:39
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("country", "0022_merge_20210226_1050"),
]
operations = [
migrations.AlterModelOptions(
... | 1.390625 | 1 |
techproject/src/mainapp/products/migrations/0002_auto_20210416_2106.py | Joshuajking/RoyalHotel-WebApp | 0 | 46973 | <reponame>Joshuajking/RoyalHotel-WebApp
# Generated by Django 2.0.7 on 2021-04-17 02:06
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('products', '0001_initial'),
]
operations = [
migrations.RenameModel(
old_name='Products',
... | 1.757813 | 2 |
Implementations/New folder/E2.py | MilladMuhammadi/Competitive-Programming | 0 | 46974 | <filename>Implementations/New folder/E2.py
command = input()
command = command.strip()
tokens = []
numbers = ['0','1','2','3','4','5','6','7','9']
if (command[:4]=="cout" and command[-1]==';'):
index = 4
while(True):
if(command[index]=='<' and command[index+1]=='<'):
index+=2
s="... | 3.65625 | 4 |
ptmv/snd.py | ryw89/ptmv | 0 | 46975 | import os
import subprocess
import tempfile
import time
import wave
import simpleaudio
def extract(file):
ptmv_tempdir = os.path.join(tempfile.gettempdir(), "ptmv")
if not os.path.exists(ptmv_tempdir): os.makedirs(ptmv_tempdir)
snd_file = ptmv_tempdir + str(int(time.time())) + ".wav"
command = "ffmpeg -i " + file ... | 2.65625 | 3 |
modoboa/lib/tests/test_web_utils.py | HarshCasper/modoboa | 1,602 | 46976 | <gh_stars>1000+
"""Tests for web_utils."""
from django.test import SimpleTestCase
from .. import web_utils
class TestCase(SimpleTestCase):
"""Test functions."""
def test_size2integer(self):
self.assertEqual(web_utils.size2integer("1024"), 1024)
# Convert to bytes
self.assertEqual(we... | 2.78125 | 3 |
rpg/lib.py | FlorianLeChat/Python-RPG | 0 | 46977 | <reponame>FlorianLeChat/Python-RPG
#
# Try to check if the input is a number.
# https://stackoverflow.com/a/1267145
#
def tryGetNumber(value = ""):
try:
int(value)
return True
except ValueError:
return False
#
# Try to retrieve the input from the usage by checking the termination
# controls like CTRL+C to stop... | 3.265625 | 3 |
Engine/code processing/TileSpliter.py | Wildric-Auric/OpenGL_TopDownShooter | 9 | 46978 | # -*- coding: utf-8 -*-
"""
Created on Thu Dec 30 11:53:32 2021
@author: HP
"""
PATH = "Forest.png"
from PIL import Image
sprites = [Image.new("RGBA", (32, 32), (0,0,0,0)) for x in range(8*6)]
current = 0
with Image.open(PATH) as im:
curI = 0
curJ = 0
for curI in range(0,256,32):
for curJ in range(... | 3.0625 | 3 |
examples/pause.bench.py | noirbizarre/minibench | 4 | 46979 | from minibench import Benchmark
import time
class PauseBenchmark(Benchmark):
times = 10
def bench_one_hundredth(self):
time.sleep(.01)
def bench_one_tenth(self):
time.sleep(.1)
| 2.40625 | 2 |
WebODM-master/plugins/cloudimport/platforms/piwigo.py | abhinavsri000/UAVision | 0 | 46980 | # Check http://piwigo.com/
from urllib.parse import urlparse
from os import path
from plugins.cloudimport.cloud_platform import File, Folder
from plugins.cloudimport.extensions.cloud_library import CloudLibrary
class Platform(CloudLibrary):
def __init__(self):
super().__init__('Piwigo', 'http://{server_url... | 2.875 | 3 |
krvjezivot/users/migrations/0003_users_donors.py | jkvakaric/krv-je-zivot | 0 | 46981 | <filename>krvjezivot/users/migrations/0003_users_donors.py
# Generated by Django 2.0.5 on 2018-05-23 22:44
from django.db import migrations, models
import enumfields.fields
import krvjezivot.donations.enums
import krvjezivot.users.enums
class Migration(migrations.Migration):
dependencies = [
('users', '... | 1.882813 | 2 |
data/preprocessing/utils.py | timoninn/pide-pipe | 1 | 46982 | <reponame>timoninn/pide-pipe
import pandas as pd
def apply_cat_op(
data: pd.DataFrame,
attrs: [str],
operation,
prefix: str
):
"""
Apply one operation to data attributes.
"""
series = [data[attr].map(operation) for attr in attrs]
_data = pd.concat(series, axis=1).add_prefix(prefix... | 2.65625 | 3 |
python-backend/tests/mines/resources/test_mine_commodity_code.py | MaxWardle/mds | 0 | 46983 | <gh_stars>0
import json
from tests.constants import (
TEST_MINE_TYPE_GUID,
TEST_MINE_COMMODITY_CODES,
TEST_MINE_COMMODITY_DESCRIPTIONS
)
def test_get_all_mine_commodity_types(test_client, auth_headers):
get_resp = test_client.get('/mines/commodity-codes', headers=auth_headers['full_auth_header'])
... | 2.203125 | 2 |
chatbot/app/libs/forecast.py | aeea-0605/chatbot-repo | 0 | 46984 | <reponame>aeea-0605/chatbot-repo<filename>chatbot/app/libs/forecast.py
import requests
from app.libs import naver
def kakao_local(KAKAO_KEY, addr):
"""
kakao_local function : 특정 지역에 대한 좌표를 제공해주는 함수
input arguments : kakao_rest_api_key, region(korean)
return lat, lon (about region)
"""
ur... | 2.640625 | 3 |
solver.py | mahaitongdae/Approximate-dynamic-Programming | 7 | 46985 | """
<Reinforcement Learning and Control>(Year 2020)
by <NAME>
@ Intelligent Driving Lab, Tsinghua University
OCP example for lane keeping problem in a circle road
[Method]
Model predictive control
"""
from casadi import *
from config import DynamicsConfig
import math
from dynamics import... | 3.328125 | 3 |
unit-hypersphere-nn/eval_knn_sphere.py | PepSalehi/algorithms | 0 | 46986 | #!/usr/bin/env python
"""Create benchmark for k nearest neighbor on unit sphere in R^k."""
# Scroll down to line 90 to "Adjust this" to add your experiment
import random
import numpy as np
import os.path
import logging
import sys
import Queue as queue
import h5py
import time
logging.basicConfig(format='%(asctime)s %... | 3.28125 | 3 |
findhorn_multi.py | richplane/PyREmatcher | 1 | 46987 | <reponame>richplane/PyREmatcher
import scheduler
import pandas as pd
import numpy as np
# This file is a simulation script that run the Scheduler model repeatedly, simulating
#
# There are two different PV arrays
pv_arrays = [
{
'name' : 'Terrace',
'surface_tilt' : 30,
'surface_azimuth' : ... | 2.40625 | 2 |
learnergy/core/__init__.py | anukaal/learnergy | 39 | 46988 | """A core package for all common learnergy modules.
"""
from learnergy.core.dataset import Dataset
from learnergy.core.model import Model
| 0.976563 | 1 |
setup.py | RosettaCommons/pyrosetta_colab_setup | 1 | 46989 | from setuptools import setup
setup(name='pyrosettacolabsetup',
version='0.5',
description='Mounts Google Drive for PyRosetta use in Google Colaboratory',
url='https://github.com/kathyle9/pyrosettacolabsetup',
author='kathyle9',
author_email='<EMAIL>',
license='MIT',
packages=[... | 1.367188 | 1 |
my_decorator.py | 4enzo/learning_py | 0 | 46990 | <reponame>4enzo/learning_py<filename>my_decorator.py<gh_stars>0
# -*- coding: utf-8 -*-
'''
Created on 2022-03-16
@author: Enzo
'''
import time
import functools
def run_time(func):
"函数运行时长"
@functools.wraps(func)
def inner(*args, **kwargs):
start_time = time.time()
result =... | 3.109375 | 3 |
pyccl/__init__.py | Russell-Jones-OxPhys/CCL | 0 | 46991 | """The pyccl package contains all of the submodules that are implemented in
individual files in CCL.
"""
# flake8: noqa
from pkg_resources import get_distribution, DistributionNotFound
try:
__version__ = get_distribution(__name__).version
except DistributionNotFound:
# package is not installed
pass
# Sets ... | 1.703125 | 2 |
src/oci/data_integration/models/task_run.py | LaudateCorpus1/oci-python-sdk | 0 | 46992 | # 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.0. You may c... | 1.734375 | 2 |
Python/isPalindrome/palindrometextchecker.py | Wilo/exercises | 0 | 46993 | """
Source: https://en.wikipedia.org/wiki/Palindrome#Names
"""
def is_palindrome(text: str) -> bool:
return text.lower() == text.lower()[::-1]
if __name__=='__main__':
text = input('Give me the text to analyze: ')
print(f'{text} Is Palindrome?: {is_palindrome(text)}')
| 4.25 | 4 |
test.py | VianneyRousset/paramobject | 0 | 46994 | #!/usr/bin/env python
# pylint: disable=disallowed-name
# pylint: disable=missing-class-docstring,
# pylint: disable=missing-function-docstring,
# pylint: disable=no-self-use
import unittest
from paramobject import ParametrizedObject, parameter, Parameter
class TestParametrizedObject(unittest.TestCase):
def te... | 2.828125 | 3 |
source/Utils.py | jonbrew/Arbiter | 0 | 46995 | def pct_inc(p1, p2) :
return ((p2-p1)/p1)*100
| 2 | 2 |
src/app/cfg.py | PSPC-SPAC-buyandsell/von_tails | 1 | 46996 | """
Copyright 2017-2020 Government of Canada - Public Services and Procurement Canada - buyandsell.gc.ca
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
... | 1.492188 | 1 |
forumdemo/comment/admin.py | lamdba0602/forumdemo | 0 | 46997 | from django.contrib import admin
from .models import Comment
class CommentAdmin(admin.ModelAdmin):
list_display = ("article", "to_comment", "status", "owner", "content")
admin.site.register(Comment, CommentAdmin)
| 1.710938 | 2 |
src/166. Fraction to Recurring Decimal.py | xiaonanln/myleetcode-python | 0 | 46998 | <reponame>xiaonanln/myleetcode-python
import time
class Solution(object):
def fractionToDecimal(self, numerator, denominator):
"""
:type numerator: int
:type denominator: int
:rtype: str
"""
if numerator == 0: return '0'
if numerator < 0 and denominator < 0:... | 3.53125 | 4 |
code/ml/gptheano/vecgpdm/test.py | dmytrov/gaussianprocess | 0 | 46999 | <reponame>dmytrov/gaussianprocess<filename>code/ml/gptheano/vecgpdm/test.py
import os
import numpy as np
import matplotlibex as plx
import numerical.numpytheano.theanopool as tp
import ml.gptheano.vecgpdm.multiprimitivemodel as mdl
import ml.gptheano.vecgpdm.kernels as krn
import ml.gptheano.vecgpdm.equations as vceq
... | 2.140625 | 2 |