seq_id
stringlengths
4
11
text
stringlengths
113
2.92M
repo_name
stringlengths
4
125
โŒ€
sub_path
stringlengths
3
214
file_name
stringlengths
3
160
file_ext
stringclasses
18 values
file_size_in_byte
int64
113
2.92M
program_lang
stringclasses
1 value
lang
stringclasses
93 values
doc_type
stringclasses
1 value
stars
int64
0
179k
โŒ€
dataset
stringclasses
3 values
pt
stringclasses
78 values
37370950188
import argparse import openai import json import time from tqdm.auto import tqdm from settings import settings from textwrap import dedent def evaluate(dataset: str, gold_path, log_file: str): """ Returns the average score for the dataset. Args: dataset: Path to the json dataset log_file: ...
ZanezZephyrs/AutoSurvey
AutoSurvey/evaluation/evaluate.py
evaluate.py
py
5,555
python
en
code
0
github-code
6
26803495013
import random import copy class Board: def __init__(self, players: tuple, columns=64, rows=48): """ Initialize the game, and sets defaults setting. """ self.columns = columns self.rows = rows self.players = players self.history_grid = [[-1 for i in range(sel...
vichango/infolipo
GameOfLife/src/board.py
board.py
py
4,078
python
en
code
0
github-code
6
11107764647
aa=input() aa2=list(map(int,input().split())) c=d=0 for i in range(0,len(aa2)+1): if(i==aa2[i]): c=c+1 else: d=d+1 break if(d>=1): print(d)
Ibarsjoel1234/Program-Python
lenasindex.py
lenasindex.py
py
176
python
fa
code
0
github-code
6
2705587377
from __future__ import annotations import abc from collections import ChainMap from typing import Any, ClassVar, Optional, Type, TypeVar import attr from basic_notion import exc from basic_notion.utils import set_to_dict, del_from_dict def _get_attr_keys_for_cls( members: dict[str, Any], only_edita...
altvod/basic-notion
src/basic_notion/base.py
base.py
py
4,973
python
en
code
6
github-code
6
9836602574
import matplotlib.pyplot as plt import numpy as np k=9.0e9 q=1.9e-19 d=1.0e1 t=np.linspace(0,2*np.pi,10000) i=1 V=V=(3*k*q*(d**2)/(2*(i**3)))*np.cos(2*t) plt.plot(t,V,color='black') plt.xlabel('theta') plt.ylabel('Potential') plt.show()
Rohan-Chakravarthy/Basic-Mathematics-Programs
quad alt.py
quad alt.py
py
247
python
en
code
0
github-code
6
33022799224
from django.conf.urls import patterns, include, url from django.contrib.staticfiles.urls import staticfiles_urlpatterns from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', url(r'^$', 'yj.views.home'), url(r'^api/', include('api.urls')), # Include an application: # url...
bob1b/yj
yj/urls.py
urls.py
py
477
python
en
code
0
github-code
6
27984628392
from scipy.io.wavfile import read, write import io import matplotlib.pyplot as plt ## This may look a bit intricate/useless, considering the fact that scipy's read() and write() function already return a ## numpy ndarray, but the BytesIO "hack" may be useful in case you get the wav not through a file, but trough some w...
Hrithik0the0research/gan-discrimator
gan/synthetic-data-generator-main/audio_read.py
audio_read.py
py
1,017
python
en
code
0
github-code
6
70789372028
# Counting element # Given an integer array, count element x such that x + 1 is also in array.If there're duplicates in array, count them separately. # Example 1: # Input: {1, 2, 3} # Output: 2 # Explanation: # First element is 1 + 1 = 2 (2 is present in an array) # ...
deepk777/leetcode
30-day-challenge-2020/April/week1/day7-counting-element.py
day7-counting-element.py
py
1,238
python
en
code
1
github-code
6
40128549954
# included from libs/mincostflow.py """ Min Cost Flow """ # derived: https://atcoder.jp/contests/practice2/submissions/16726003 from heapq import heappush, heappop class MinCostFlow(): def __init__(self, n): self.n = n self.graph = [[] for _ in range(n)] self.pos = [] def add_edge(s...
nishio/atcoder
PAST3/o.py
o.py
py
5,401
python
en
code
1
github-code
6
33369908821
""" A script to extract IuPS addresses from an RNC CMExport file Works with Huawei RNC CMExport By Tubagus Rizal 2017 """ import xml.etree.ElementTree as ET import glob import pdb def getRncInfo(xmlroot): # get RNC info rnc = {} for rncInfo in xmlroot.findall(".//*[@className='BSC6900...
trizal/python-CMExportReader
getIuPS.py
getIuPS.py
py
1,817
python
en
code
0
github-code
6
5606424198
chicken_orders = int(input()) fish_orders = int(input()) veg_orders = int(input()) delivery_fee = 2.50 chicken_meal = 10.35 fish_meal = 12.40 veg_meal = 8.15 food_price = (chicken_orders * chicken_meal) + (fish_orders * fish_meal) + (veg_orders * veg_meal) dessert = food_price * 0.20 full_cost = food_price + dessert...
koleva26k/programming_basics
food_delivery.py
food_delivery.py
py
354
python
en
code
0
github-code
6
24991661721
def ustr(value): """This method is similar to the builtin `str` method, except it will return Unicode string. @param value: the value to convert @rtype: unicode @return: unicode string """ if isinstance(value, unicode): return value if hasattr(value, '__unicode__'): r...
factorlibre/openerp-extra-6.1
comparison/website/erpComparator/erpcomparator/__init__.py
__init__.py
py
500
python
en
code
9
github-code
6
12388726621
import os, sys import subprocess import json import uproot import awkward as ak from coffea import processor, util, hist from coffea.nanoevents import NanoEventsFactory, NanoAODSchema from boostedhiggs import HbbPlotProcessor from distributed import Client from lpcjobqueue import LPCCondorCluster from dask.distribut...
jennetd/hbb-coffea
vbf-scripts/submit-plots-dask.py
submit-plots-dask.py
py
2,206
python
en
code
4
github-code
6
29867399693
import os import csv import sqlite3 DATA_DIR="data" DATABASE="database.db" sensors = { "dht22": { "table": "temperaturUndLuftdruck", "mapping": { "sensor_id": "SensorID", "timestamp": "datetime", "humidity": "luftwert", "temperature": "tempwert" ...
Jan200101/feinstaub-projekt
import.py
import.py
py
1,971
python
en
code
0
github-code
6
73252316348
"""" ะ”ะปั ะทะฐะดะฐะฝะฝะพะณะพ ะฝะฐะฑะพั€ะฐ N ั‚ะพั‡ะตะบ ะฝะฐ ะฟะปะพัะบะพัั‚ะธ ะฝะฐะนั‚ะธ ะฟั€ัะผะพัƒะณะพะปัŒะฝะธะบ ะผะธะฝะธะผะฐะปัŒะฝะพะน ะฟะปะพั‰ะฐะดะธ, ัะพะดะตั€ะถะฐั‰ะธะน ะฒัะต ัƒะบะฐะทะฐะฝะฝั‹ะต ั‚ะพั‡ะบะธ. ะกั‚ะพั€ะพะฝั‹ ะฟั€ัะผะพัƒะณะพะปัŒะฝะธะบะฐ ะฝะต ะพะฑัะทะฐะฝั‹ ะฑั‹ั‚ัŒ ะฟะฐั€ะฐะปะปะตะปัŒะฝั‹ะผะธ ะบะพะพั€ะดะธะฝะฐั‚ะฝั‹ะผ ะพััะผ """ # important functions: MinimumBoundingBox from scipy.spatial import ConvexHull from math import sqrt,atan2 import numpy as...
ded-evsey/TandACG
21.py
21.py
py
6,002
python
en
code
0
github-code
6
29249896795
import matplotlib.pyplot as plt import seaborn as sns from table import create_table import pandas as pd import streamlit as st import plotly.tools as tls import plotly.figure_factory as ff import numpy as np import plotly.express as px from download import report_downlaoder import os st.image('Somaiya Header.png',wid...
rahulthaker/Result-analysis
Analysis.py
Analysis.py
py
6,347
python
en
code
0
github-code
6
39943332700
from decouple import config from logic import bet My_Money = int(config('MY_MONEY')) while True: print('you have ' + str(My_Money)) print('do you wanna play? (yes or no)') a = input('') if a.strip() == 'no': print('you are out of the game') break elif a.strip() == 'yes': b =...
aliiiiaa/hw5
25-2_Aliia_Abyllkasymova_hw_5.py
25-2_Aliia_Abyllkasymova_hw_5.py
py
509
python
en
code
0
github-code
6
30906506351
import mailchimp_marketing as MailchimpMarketing from mailchimp_marketing.api_client import ApiClientError def survey_monkey_distribute_daily(**kwargs): api_key = kwargs['api_key'] server = kwargs['server'] try: client = MailchimpMarketing.Client() client.set_config({ "api_key": api_key, "se...
GregorMonsonFD/holmly_sourcing_legacy
scripts/python/survey_monkey_distribute_daily.py
survey_monkey_distribute_daily.py
py
525
python
en
code
0
github-code
6
26986931486
# -*- coding: utf-8 -*- import itertools import struct import pytest from mock import Mock, call, patch from nameko_grpc.errors import GrpcError from nameko_grpc.streams import ( STREAM_END, ByteBuffer, ReceiveStream, SendStream, StreamBase, ) class TestByteBuffer: def test_peek(self): ...
nameko/nameko-grpc
test/test_streams.py
test_streams.py
py
15,281
python
en
code
57
github-code
6
30386260395
#!/usr/bin/env python3 import os import urllib import requests import config def dump_stories(): new_stories = 0 num_stories = 0 r = requests.get( "https://i.instagram.com/api/v1/feed/reels_tray/", cookies=config.instagram_cookies, headers=config.instagram_headers).json() for user in...
bl1nk/instadump
instadump.py
instadump.py
py
2,019
python
en
code
9
github-code
6
39495192143
n=int(input()) s=input() li=s.split(" ") for i in range(len(li)): li[i]=int(li[i]) li.sort(reverse=True) a=li[0] li2=[] i=0 while i<n: if (a%li[i]==0) and (li[i] not in li2): li2.append(li[i]) del li[i] i-=1 n-=1 i+=1 print(li[0]) print...
skshahriarahmedraka/codeforces-python
1108B.py
1108B.py
py
330
python
en
code
4
github-code
6
16172136194
import numpy as np from my_function import smooth_curve from my_cnet import SimpleConvNet from mnist import load_mnist from my_optimizer import Adam import matplotlib.pyplot as plt from sklearn.metrics import confusion_matrix import seaborn as sns (x_train,t_train),(x_test,t_test) = load_mnist(flatten=False) network...
kang9kang/DL-learning
cnn/my_cnn_train.py
my_cnn_train.py
py
3,081
python
en
code
1
github-code
6
23642650864
# -*- coding:utf-8 -*- #@Time : 2020/4/27 16:05 #@Author: Triomphe #@File : vulscan.py import importlib import os import sys from PyQt5.QtCore import QObject, pyqtSignal from vulscan.port_scan import portscan from modules.mod_get_rootPath import get_root_path sys.path.append(os.path.abspath( os.path.dirname(__fi...
TriompheL/Ratel
vulscan/vulscan.py
vulscan.py
py
2,337
python
en
code
1
github-code
6
26043642636
from __future__ import annotations from dataclasses import dataclass from enum import Enum from typing import List, cast from pants.backend.project_info import dependents from pants.backend.project_info.dependents import Dependents, DependentsRequest from pants.base.build_environment import get_buildroot from pants.b...
pantsbuild/pants
src/python/pants/vcs/changed.py
changed.py
py
6,103
python
en
code
2,896
github-code
6
74128328188
import sys input = sys.stdin.readline t = int(input()) order = [list(input().strip()) for i in range(t)] for i in range(t-1): for j in range(len(order[i])): if order[i][j] != order[i+1][j]: order[i+1][j] = '?' print("".join(order[-1]))
Dayeon1351/TIL
BAEKJOON/1032.py
1032.py
py
273
python
en
code
0
github-code
6
41682544130
"""add unique index for modalities Revision ID: 3cccf6a0af7d Revises: ba3bae2b5e27 Create Date: 2018-01-05 14:28:03.194013 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '3cccf6a0af7d' down_revision = 'ba3bae2b5e27' branch_labels = None depends_on = None def...
MondayHealth/provider-import
alembic/versions/3cccf6a0af7d_add_unique_index_for_modalities.py
3cccf6a0af7d_add_unique_index_for_modalities.py
py
749
python
en
code
0
github-code
6
22762001346
print("Welcome to the GPA calculator.") courses=int(input("Enter number of courses:")) GpaList=[] CreditList=[] Markcount=0 Creditcount=0 print('Enter marks in percentage and then credit for that course in the next line') for a in range(courses): Markcount+=1 Creditcount+=1 mark=int(input('mar...
AkashMalhotra/GpaCalculator
GPACalculator/main.py
main.py
py
1,382
python
en
code
0
github-code
6
38829812575
from django.shortcuts import render , get_object_or_404 , get_list_or_404 from django.contrib.auth.decorators import login_required from .models import Members # Create your views here. @login_required(login_url="/") def onemember_record(request , name): objlist = get_list_or_404(Members , name = name) objlist = ...
hiteshkhatana/khatana-society-django
members/views.py
views.py
py
1,267
python
en
code
0
github-code
6
11896448439
from unittest import mock from django.http import HttpRequest from google_optimize.utils import _parse_experiments, get_experiments_variants def test_parses_single_experiment_cookie(): request = HttpRequest() request.COOKIES["_gaexp"] = "GAX1.2.utSuKi3PRbmxeG08en8VNw.18147.1" experiments = _parse_experi...
danihodovic/django-google-optimize
tests/test_utils.py
test_utils.py
py
4,156
python
en
code
null
github-code
6
41682684008
import torch #Linear regression for f(x) = 4x+3 X= torch.tensor([1,2,3,4,5,6,7,8,9,10], dtype=torch.float32) Y=torch.tensor([7,11,15,19,23,27,31,35,39,43], dtype= torch.float32) w= torch.tensor(0.0,dtype=torch.float32,requires_grad=True) def forward(x): return (w*x)+3 def loss(y,y_exp): return ((y_exp-y)**2...
kylej21/PyTorchProjects
linearRegression/linearReg.py
linearReg.py
py
818
python
en
code
0
github-code
6
32177625426
from unittest import mock from itertools import product import pytest @pytest.mark.parametrize( 'user_agent, session', product( [None, mock.Mock()], [None, mock.Mock()] ) ) def test_init(user_agent, session): with mock.patch('Raitonoberu.raitonoberu.aiohttp') as m_aio: from ...
byronvanstien/Raitonoberu
tests/test_raitonoberu.py
test_raitonoberu.py
py
5,643
python
en
code
5
github-code
6
19972078722
from PIL import Image from torchvision import transforms import torch import numpy as np import pandas as pd import sys sys.path.append("d:\\Codes\\AI\\kaggle\\kaggle-CIFAR-10\\") def loadImages(): # image list images = np.zeros((300000, 3, 32, 32)) print("begining loading images") i = 0 while True...
rowenci/kaggle-CIFAR-10
submission/testProcessing.py
testProcessing.py
py
947
python
en
code
0
github-code
6
30793405343
import g2d x, y, dx, dy = 240, 240, 5,5 s=4 ARENA_W, ARENA_H = 480, 360 image = g2d.load_image("ball.png") def tick(): global x,y, dy, dx, s g2d.clear_canvas() # Draw background g2d.draw_image(image, (x, y)) # Draw foreground if g2d.key_pressed("w"): s=1 # y...
GiorCocc/python_project-unipr
Esercitazione2/controllo_da_tastiera.py
controllo_da_tastiera.py
py
752
python
en
code
0
github-code
6
11169927859
from rest_framework import serializers from review_app.models import FarmersMarket, Vendor class FarmersMarketSerializer(serializers.ModelSerializer): rating = serializers.ReadOnlyField(source='get_rating') class Meta: model = FarmersMarket fields = ['id', 'fm_name', 'fm_description', 'rating...
dhcrain/FatHen
fm_api/serializers.py
serializers.py
py
1,092
python
en
code
0
github-code
6
71811421308
#!/usr/bin/env python # -*- coding:utf-8 -*- """code_info @Time : 2020 2020/7/10 15:42 @Author : Blanc @File : double_color_ball2.py """ import random import time ''' name = time.strftime('%Y-%m-%d', time.localtime()) print(name) f = open(file=name + '.txt', mode='w', encoding='utf-8-sig') a = list(...
Flynn-Lu/PythonCode
2020pythonๅฎž่ฎญ/Day7/double_color_ball2.py
double_color_ball2.py
py
685
python
en
code
0
github-code
6
71968210427
from django.conf.urls import url from mainapp import views urlpatterns = [ url(r'^$', views.index, name='index'), url(r'^category/(?P<category_name_slug>[\w\-]+)/$', views.view_category, name='category'), url(r'^search_dictionary/$', views.search_dictionary, name="search_dictionary"), url(r'^search/$',...
Gystark/Tech4Justice2016
mainapp/urls.py
urls.py
py
637
python
en
code
0
github-code
6
7092840234
#!/usr/bin/env python3 # from https://stackoverflow.com/a/55902915/5555077 # from contextlib import contextmanager # # @contextmanager # def nullcontext(enter_result=None): # yield enter_result import contextlib cm = contextlib.nullcontext() if __name__ == "__main__": with cm as context: print("abc"...
K-Wu/python_and_bash_playground
try_null_context_manager.py
try_null_context_manager.py
py
322
python
en
code
0
github-code
6
8765175527
import bpy import csv import os from bpy import context import builtins as __builtin__ def console_print(*args, **kwargs): for a in context.screen.areas: if a.type == 'CONSOLE': c = {} c['area'] = a c['space_data'] = a.spaces.active c['region'] = a.regions[-1...
baehs1989/blender-script
K_LEAGUE.py
K_LEAGUE.py
py
15,516
python
en
code
0
github-code
6
37303345220
# Superposition of 2 spirals import tkinter from matplotlib.backends.backend_tkagg import (FigureCanvasTkAgg, NavigationToolbar2Tk) from matplotlib.figure import Figure import matplotlib.animation as animation import numpy as np from matplotlib.patches import Circle import mpl_toolkits.mplot3d.art3d as art3d def chan...
marukatsutech/superposition_of_2_spirals
superposition_of_2_spirals.py
superposition_of_2_spirals.py
py
8,121
python
en
code
0
github-code
6
41236219255
"""myProject URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/4.0/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-bas...
beishangongzi/myProject
myProject/urls.py
urls.py
py
1,926
python
en
code
0
github-code
6
36193733670
from graftm.graftm_package import GraftMPackage, GraftMPackageVersion3 import dendropy import logging import tempfile from Bio import SeqIO import extern from .singlem_package import SingleMPackageVersion2 import shutil import os import tempdir class PackageCreator: def create(self, **kwargs): input_graftm...
ye00ye/singlem
singlem/package_creator.py
package_creator.py
py
5,879
python
en
code
null
github-code
6
28914738818
import os import unittest import json from functools import wraps from flask_sqlalchemy import SQLAlchemy from app import create_app from models import setup_db, Movie, Actor class CapstoneTestCase(unittest.TestCase): """This class represents the trivia test case""" def setUp(self): """Define test v...
steffaru/FSND_CaptionProject
test_flaskr.py
test_flaskr.py
py
9,453
python
en
code
0
github-code
6
5092386647
S = input() T = input() N = len(S) res = "No" for i in range(N+1): r = S[-1] + S[:N-1] if r == T: res = "Yes" break S = r print(res)
sudiptob2/atcoder-training
Easy 100/60. String Rotation.py
60. String Rotation.py
py
163
python
en
code
2
github-code
6
41873337753
import sys from firebaseConfig import firebase from config import CLAN_CODE, CLAN_INFO_FILE_PATH, CLAN_QUEST_INFO_FILE_PATH from clanDatabase import ClanDatabase def main(): db = ClanDatabase( CLAN_CODE, CLAN_INFO_FILE_PATH, CLAN_QUEST_INFO_FILE_PATH, firebase.database() ) process_command(db) def process_...
ygongdev/FishBotScripts
main.py
main.py
py
1,424
python
en
code
0
github-code
6
30217328394
# Libraries import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns #Import all datasets df_customers=pd.read_csv('olist_customers_dataset.csv') df_geolocation=pd.read_csv('olist_geolocation_dataset.csv') df_order_items=pd.read_csv('olist_order_items_dataset.csv') df_order_pay=pd.r...
ThePeziBear/MyPythonLibrary
Masterthesis/Olist/Data_Manipulation_V2.py
Data_Manipulation_V2.py
py
6,260
python
en
code
0
github-code
6
3520676139
import json import os import time import pytest from src.rss_config_io import RssConfigIO from src.rss_configuration import RssConfiguration class TestRssConfiguration: rss = "http://g1.globo.com/dynamo/rss2.xml" timestamp = [2019, 8, 24, 2, 56, 52, 5, 236, 0] temp = "missing_file.json" base_content...
maxpeixoto/rss_filterer
test/test_rss_configuration.py
test_rss_configuration.py
py
2,655
python
en
code
0
github-code
6
39028052059
import google_auth_oauthlib import google_auth_oauthlib.flow scopes = ["https://www.googleapis.com/auth/youtube.force-ssl"] api_service_name = "youtube" api_version = "v3" client_secrets_file = "client_secret.json" def main(): # Get credentials and create an API client flow = google_auth_oauthlib.flow.Instal...
omirete/free-live-news
automations/get_youtube_bearer_token.py
get_youtube_bearer_token.py
py
521
python
en
code
0
github-code
6
34508803750
# https://www.geeksforgeeks.org/next-higher-palindromic-number-using-set-digits/ # def next_palindrome(num): # nums= [int(x) for x in num] # if len(num) <= 3: # return -1 # from collections import Counter # t = Counter(nums) # palins =[x for x,y in t.items() if y...
ved93/deliberate-practice-challenges
code-everyday-challenge/n204_next_palindrom.py
n204_next_palindrom.py
py
3,157
python
en
code
0
github-code
6
8331020218
import os import datetime import mysql.connector from reportlab.lib.pagesizes import letter from reportlab.platypus import SimpleDocTemplate, Table, TableStyle, Paragraph from reportlab.lib import colors from reportlab.lib.styles import getSampleStyleSheet # pip install mysql-connector-python # pip install reportlab ...
IgnaciodeJesusMedinaUrrunaga/Attendance-Registration-with-Facial-Recognition
Attendance_Registration_CIA/Attendance-list-with-facial-recognition-using-Python/transfer_today_records_to_pdf.py
transfer_today_records_to_pdf.py
py
2,145
python
en
code
2
github-code
6
39484921730
class LCG(object): def __init__(self, a, c, x): self.a = a self.c = c self.x = x self.mod = 1<<32 def next(self): self.x *= self.a self.x += self.c self.x %= self.mod return self.x >> 31 def keystream(k): g1 = LCG(71664525, 1013...
Himanshukr000/CTF-DOCKERS
greyhatCrypto/challenges/correlation/correlation.py
correlation.py
py
840
python
en
code
25
github-code
6
3828632722
from collections import Counter from data import SentimentDataset import json class Preprocessor: def __init__(self, max_vocab): self.max_vocab = max_vocab self.vocab2enc = None self.enc2vocab = None self.max_len = 0 def fit(self, dataset): words = list() for i...
yuvalofek/NLP
DeepLearning/prepro.py
prepro.py
py
3,090
python
en
code
0
github-code
6
5024232926
from tfidf import * zipfilename = sys.argv[1] summarizefile = sys.argv[2] def main(): files_dic = load_corpus(sys.argv[1]) tfidf = compute_tfidf(files_dic) score_lst = summarize(tfidf, files_dic[sys.argv[2]], 20) for i in range(len(score_lst)): print(score_lst[i][0] + " " + str(round(score_ls...
wangyuhsin/tfidf-text-summarization
summarize.py
summarize.py
py
374
python
en
code
0
github-code
6
30728799570
import sys # infile = open("a.in") infile = sys.stdin n = int(infile.readline()) for i in range(n): c, s = [int(x) for x in infile.readline().split()] k = s // c m = s - k * c q = 0 q+= ((k+1)**2) * m + (k**2)* (c-m) print(q)
mdaw323/alg
codeforces/edu-77/a.py
a.py
py
260
python
en
code
0
github-code
6
32617432475
# find maximum element in the list def find_max(a_list): max = None if a_list == []: return 0 for num in a_list: if max == None: max = num elif num > max: max = num return max user_input = input('Please input a list: ') if user_input != '[]': user_i...
TsungYuanHsu/find_max
find_max.py
find_max.py
py
653
python
en
code
0
github-code
6
12634573747
import pygame import sys from snake_object import Snake from setting import Setting from apple import Apple def press_keydown(snake, event): if event.key == pygame.K_LEFT: snake.go_x = -1 snake.go_y = 0 elif event.key == pygame.K_RIGHT: snake.go_x = 1 snake.go_y = 0 elif eve...
BarSerhey/Python
snake/snake.py
snake.py
py
1,770
python
en
code
0
github-code
6
30938963931
import pandas as pd from config import CONFIG_DICT import networkx as nx import matplotlib.pyplot as plt import random import cv2 import numpy as np import math from MplCanvas import MplCanvas import Equirec2Perspec as E2P new_min = -100 new_max = 100 lat_min = 40.42524817 ## this is for first 500 in pittsb...
klekkala/usc_navigate
src/data_helper.py
data_helper.py
py
14,529
python
en
code
2
github-code
6
24276436490
#!/usr/bin/env python3 import os import requests from fmiopendata.wfs import download_stored_query import datetime import json import pandas as pd import json def give_prediction(stationId, month, day, hour): place = "latlon=60.3267,24.95675" # default place is Veromiehenkylรค stationShortCode = '' weathe...
millalin/Train-predictor
application/helpers/weather_for_model.py
weather_for_model.py
py
2,255
python
en
code
0
github-code
6
17419658730
import json import os from pyui.geom import Size from .base import View DATA_DIR = os.path.join( os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "data" ) class Text(View): def __init__(self, text, **options): super().__init__(**options) self.text = str(text) self._min_c...
dcwatson/pyui
pyui/views/text.py
text.py
py
1,649
python
en
code
21
github-code
6
30481034470
import Tkinter import tkFont top = Tkinter.Tk() top.geometry('250x150') top.title("IHRD") top.config(background='black') window1 = Tkinter.Label(top,bg='black') window1.pack() def def1(): execfile("graph.py") button1=Tkinter.Button(top,text="District frequency",command=def1 ,bg='#981212',fg='white',font=tkFont.Font(we...
varshiniramesh/IHDS-analysis
widget.py
widget.py
py
385
python
en
code
0
github-code
6
27855486756
import numpy as np import torch import os from collections import OrderedDict from torch.autograd import Variable import itertools import util.util as util from util.image_pool import ImagePool from .base_model import BaseModel from . import networks import sys # TODO (1) remove CycleLoss? # We have feat_loss_Ar...
amandaullvin/CycleGAN_destreak_MRI
models/cycle_wgan_model.py
cycle_wgan_model.py
py
23,263
python
en
code
0
github-code
6
72334950909
def maxUnits(boxTypes, truckSize): boxTypes.sort(key=lambda x: x[1]) sorted_list = (boxTypes)[::-1] print(sorted_list) count_units = 0 for box_nums, unit in sorted_list: if truckSize <= box_nums: count_units += truckSize * unit break count_units += box_nums *...
ChitraVKumar/My-Algorithms-for-Leetcode
Max Units in a truck.py
Max Units in a truck.py
py
432
python
en
code
0
github-code
6
6246195016
def set_font(): import platform import matplotlib.font_manager as fm system_name = platform.system() if system_name == 'Windows': return 'Malgun Gothic' elif system_name == 'Darwin': return 'AppleGothic' elif system_name == 'Linux': path = '/usr/share/font/truetype/nanum...
cheesecat47/ML_DL_Jan2020
Jan16/matplot_font.py
matplot_font.py
py
588
python
en
code
0
github-code
6
74918974586
from dataclasses import dataclass from collections import defaultdict import math @dataclass class Punto: x: int y: int owner: int def distancia(p1,p2): return abs(p1.x-p2.x)+abs(p1.y-p2.y) def day6(file): with open(file) as f: lines = f.readlines() puntosControl = list() xlist = ...
aarroyoc/advent-of-code-2018
python/day6/day6.py
day6.py
py
2,152
python
es
code
1
github-code
6
10036308173
""" Input pipeline (tf.dataset and input_fn) for GQN datasets. Adapted from the implementation provided here: https://github.com/deepmind/gqn-datasets/blob/acca9db6d9aa7cfa4c41ded45ccb96fecc9b272e/data_reader.py """ from __future__ import absolute_import from __future__ import division from __future__ import print_fun...
ogroth/tf-gqn
data_provider/gqn_provider.py
gqn_provider.py
py
9,919
python
en
code
189
github-code
6
15419264437
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Jan 9 14:52:17 2022 @author: elie """ #################### SCALING #################### import os os.chdir('/home/elie/Documents/Tecnico/2ND_PERIOD/DS/PROJECT/CODE/') from pandas import read_csv, DataFrame, concat, unique from pandas.plotting im...
elielevy3/DATA_SCIENCE_TECNICO
lab_3.py
lab_3.py
py
5,182
python
en
code
0
github-code
6
4930731104
# -*- coding: utf-8 -*- """ Description: Deep Patch Learning Model Author: wondervictor """ import math import torch import torch.nn as nn import numpy as np import layers import basenet class PatchHeadNetwork(nn.Module): def __init__(self, use_cuda, num_classes, use_relation=False): super(PatchHeadNet...
wondervictor/dpl.pytorch
models/dpl.py
dpl.py
py
3,460
python
en
code
7
github-code
6
19072626002
import requests import json import logging import sys import json import pandas as pd from pathlib import Path from requests_html import HTMLSession def parse_and_download_files(servicetags_public, msftpublic_ips, officeworldwide_ips): # URL for Feeds azurepublic = "https://www.microsoft.com/en-us/download/co...
microsoft/mstic
.script/get-msftpubliip-servicetags.py
get-msftpubliip-servicetags.py
py
2,873
python
en
code
87
github-code
6
34004541732
from heapq import heappush, heappop n = int(input()) card = [] for _ in range(n): heappush(card,int(input())) # ๋“ค์–ด์˜ค๋Š” ์ˆœ์„œ๋Œ€๋กœ ์ •๋ ฌ print(card) answer = 0 while card: print(heappop(card)) # while len(card) > 1: # a = heappop(card) # b = heappop(card) # heappush(card, a+b) # answer += a+b print(answ...
jinman-kim/algo
1715.py
1715.py
py
343
python
en
code
0
github-code
6
4414802622
import turtle #Best practice is to place functions after an import def square(len): for i in range(4): turtle.forward(len) turtle.left(90) def rectangle(width, height): for i in range(2): turtle.forward(width) turtle.left(90) turtle.forward(height) turtle.left(90) turtle.shape("turtle")...
Wizard-Fingers/fun_times
main.py
main.py
py
656
python
en
code
0
github-code
6
2523111157
"""Bubble sort implementation: running time == O(n^2)""" import copy class BubbleSort: def __init__(self, items): self.items = items self.n = len(items) def run(self): A = copy.deepcopy(self.items) for i in range(self.n-1): for j in range(self.n-1, i, -1): ...
rb05751/Algorithms
Python/algorithms/sorting/bubble_sort.py
bubble_sort.py
py
630
python
en
code
0
github-code
6
10192615887
import numpy as np import matplotlib.pyplot as plt # data I/O filename = 'dataset.txt' file = open(filename, 'r') data = file.read() # use set() to count the vacab size chars = list(set(data)) data_size, vocab_size = len(data), len(chars) print ('data has %d characters, %d unique.' % (data_size, vocab_size)) # dictio...
shesikiran03/science-fiction-writer
Task-1 .py
Task-1 .py
py
7,092
python
en
code
0
github-code
6
15598838122
import torch from torch import nn import torch.nn.functional as F from ssd.utils_ssd.box_utils import match, log_sum_exp # evaluate conf_loss and loc_loss class MultiBoxLoss(nn.Module): def __init__(self, cfg): super(MultiBoxLoss, self).__init__() self.num_classes = cfg.num_classes self.t...
AceCoooool/detection-pytorch
ssd/utils_ssd/multiloss.py
multiloss.py
py
2,399
python
en
code
24
github-code
6
23391816430
import os import shutil import subprocess import time import pylab import imageio import numpy as np from tqdm import tqdm from skimage.io import imread, imsave def create_options(model, epoch): opts_test = { "loadSize": 512, "fineSize": 512, "how_many": 'all', "phase": 'test', ...
chang/DeepPainting
train/test_cyclegan.py
test_cyclegan.py
py
6,948
python
en
code
0
github-code
6
43223088295
from __future__ import division, print_function, unicode_literals import unittest from math import pi import numpy as np from analysis import extract_z, extract_scattering class SigmaTest(unittest.TestCase): def test_quad(self): T = 0.01 w_n = pi * (2*np.arange(10)+1) * T ImSigma = w_n ...
correlatedmaterialslaboratory/dmft-model
tests/test_analysis.py
test_analysis.py
py
783
python
en
code
1
github-code
6
32010544215
def simplify_fraction(fraction): nominator = fraction[0] denominator = fraction[1] if denominator == 0: raise Exception("Division by zero is undefined") elif nominator == 0: return 0 elif nominator > denominator: for index in range(2, denominator + 1): while (den...
1oss1ess/HackBulgaria-Programming101-Python-2018
week-2/02.Testing/testing.py
testing.py
py
2,177
python
en
code
0
github-code
6
26552246319
#!/usr/bin/env python3 import fnmatch import os import re import ntpath import sys import argparse def get_private_declare(content): priv_declared = [] srch = re.compile('private.*') priv_srch_declared = srch.findall(content) priv_srch_declared = sorted(set(priv_srch_declared)) priv_dec_str = ''...
acemod/ACE3
tools/search_privates.py
search_privates.py
py
4,143
python
en
code
966
github-code
6
71947924667
def get_customer(session, w_id, d_id, c_id): prepared = session.prepare( "SELECT c_first, c_middle, c_last FROM customer \ WHERE c_w_id = ? AND c_d_id = ? and c_id = ?" ) rows = session.execute(prepared.bind((w_id, d_id, c_id))) return None if not rows else rows[0] def get_last_order(s...
hiepsieunhan/CS4224-Cassandra
script/xacts/order_status_xact.py
order_status_xact.py
py
1,339
python
en
code
0
github-code
6
23920525234
import threading import tkinter as tk from motor import Motor motor = Motor() thread_motor = threading.Thread(target=motor.inicia_motor, args=(True,)) thread_motor.daemon = True thread_motor.start() def update_value(): # Funรงรฃo para atualizar o valor # Aqui vocรช pode implementar a lรณgica desejada para atual...
PotatoMexicano/sistema-controle-eletrico
sistema_controle_eletrico/screen.py
screen.py
py
1,354
python
pt
code
0
github-code
6
33810339763
import os from random import shuffle import tensorflow as tf import glob from config import config # all functions except init and create_iterators should be empty class Preprocessing: def __init__(self): print('preprocessing instance creation started') self.dir_name = config['data_dir'] s...
ashnik777/Audio-Classification
preprocessing.py
preprocessing.py
py
3,788
python
en
code
0
github-code
6
31014267679
from transformers import ( BlenderbotSmallForConditionalGeneration, BlenderbotSmallTokenizer, BlenderbotForConditionalGeneration, BlenderbotTokenizer, ) from transformers import GPT2LMHeadModel, GPT2Tokenizer from transformers import AutoTokenizer, AutoModelForCausalLM import sys download_type = sys.ar...
DariuszO/openchat
model_download.py
model_download.py
py
1,690
python
en
code
null
github-code
6
12570656588
import discord import requests client = discord.Client() tokenFile = open('secret.secret','r') token = tokenFile.readline() @client.event async def on_message(msg): if msg.content.startswith('$$$$'): name = msg.content[4::] apiCall = 'https://na.whatismymmr.com/api/v1/summoner?name=' + name ...
gpulia/kitchenSync
server.py
server.py
py
790
python
en
code
0
github-code
6
12903355857
import csv with open ("election_results.txt", "w+") as output: with open("election_data.csv" , "r") as csvfile: readCSV = csv.reader(csvfile) data = list(readCSV) row_count = len(data) print("Election Results:") print("-------------------------") print("Tota...
Aspace-dev/Austin-Spacek---Homework-2
python-challenge/as_pypoll/austin_s_polling.py
austin_s_polling.py
py
1,846
python
en
code
0
github-code
6
5522014624
import openpyxl def get_exl(file,Sheet): exl = openpyxl.load_workbook(file) table = exl[Sheet] max_rows = table.max_row max_column = table.max_column # print(max_rows,max_column) data = [] for row in range(1, max_rows): rowdata = [] for column in range(3, max_column-1): ...
commiting/TEST
Tools/getexcel.py
getexcel.py
py
541
python
en
code
0
github-code
6
34346397693
""" Exercises of the book "Think python" 2.10 Exercises """ import math import datetime import decimal # Exercise 2 # Using the Python as a calculator # 1. The volume of a sphere with radius r is 4/3 ฯ€ r3. What is the volume of a sphere with radius 5? radius = 5 print("The volume of a sphere: ", (4 / 3 * math.pi * r...
LiliiaMykhaliuk/think-python
chapter2/2.10.2.py
2.10.2.py
py
1,916
python
en
code
0
github-code
6
33065831217
from __future__ import ( absolute_import, unicode_literals, ) from application.utils.utils import ( get_near_positions, remove_occupied_position, pick_random ) from application.entity.point import Point from application.entity.enemy_ship import EnemyShip class EnemyBoard(object): def __init__...
NTNguyetMinh/hackathon
application/entity/enemy_board.py
enemy_board.py
py
2,026
python
en
code
0
github-code
6
40960795543
import pytest from collections import Counter from ottoscript.base import OttoBase, OttoContext from ottoscript.datatypes import (Number, String, Var, Entity, List, ...
qui3xote/otto
tests/test_datatypes/datatype_test.py
datatype_test.py
py
6,300
python
en
code
1
github-code
6
74888826427
from rest_framework.serializers import CharField, ModelSerializer from .models.base import CanadianCommonCv from .models.employment import AcademicWorkExperience, Employment from .models.personal_information import Identification, Email, Website from .models.recognitions import AreaOfResearch from .models.user_profile...
c3g/ccv_api
ccv/serializers.py
serializers.py
py
2,733
python
en
code
0
github-code
6
38943946635
import wx import sys from datetime import date import webbrowser from pbalance_c import pbalance_c as balance_c from pincome_c import pincome_c as income_c from pportfolio_c import pportfolio_c as portfolio_c from padddata_c import padddata_c as adddata_c from praw_c import praw_c as raw_c from puseradd_c import puser...
tomluvoe/frugal
src/gui_c.py
gui_c.py
py
11,466
python
en
code
0
github-code
6
39122629885
import glob import PinshCmd import BomHostField from commonUtil import * class ScpHostField(PinshCmd.PinshCmd): def __init__(self): PinshCmd.PinshCmd.__init__(self, name = "scpHostName") self.helpText = "<path>\tA path to a remote location. Follows pattern: <hostname>:/path/to/file" self.b...
psbanka/bombardier
cli/lib/broken/ScpHostField.py
ScpHostField.py
py
3,148
python
en
code
1
github-code
6
37197472203
# n, m, k, p = [int(input()) for _ in range(4)] # print(n - ((m + k) - p)) ############## #2 # ls = input().split() # a = set(ls) # print(len(ls) - len(a)) # res = set() # for i in range(int(input())): # res.add(input()) # f = input() # if f in res: # print('REPEAT') # else: # print('OK') ################ #...
alecksandr-slavin/git_work
New_Python_up/ะœะฝะพะถะตัั‚ะฒะฐ/ex.1.py
ex.1.py
py
1,973
python
en
code
0
github-code
6
14394640679
import os class InputProject(): # data # Project path; file list; # id-file saving def __init__(self, inputPathList, extNameArr): self.fileList = [] # projectId-file self.projectList = inputPathList if len(extNameArr) <= 0: print('extName configuration er...
zhuwq585/MSCCD
modules/InputManagement.py
InputManagement.py
py
1,881
python
en
code
4
github-code
6
73183731388
import numpy as np import cv2 img = cv2.imread('/Users/macbookair/PycharmProjects/PR/homework2/unpro.jpg') bg = cv2.imread('/Users/macbookair/PycharmProjects/PR/homework2/back2.png')#---->3750*2500 mask = np.zeros(img.shape[:2],np.uint8) bgdModel = np.zeros((1,65),np.float64) fgdModel = np.zeros((1,65),np.float64) re...
xubinchen-very6/Pattern-recognition
prml/homework2/่ƒŒๆ™ฏๅ˜ๅ˜ๅ˜.py
่ƒŒๆ™ฏๅ˜ๅ˜ๅ˜.py
py
855
python
en
code
4
github-code
6
8215468580
import cv2 import numpy as np from PIL import Image # Load the image img = cv2.imread('ParkingLot.jpg') # Convert to grayscale gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) # Apply edge detection edges = cv2.Canny(gray, 50, 150, apertureSize=3) # Apply Hough line detection lines = cv2.HoughLines(edges, rho=1, theta=np...
TongshenH/AuE8200_perception
hw3/test.py
test.py
py
2,541
python
en
code
0
github-code
6
19130670937
from datetime import datetime import docker import mock import unittest from infra.services.android_docker import containers class FakeDevice(object): """Mocks a usb_device.Device""" def __init__(self, serial, physical_port): self.serial = serial self.physical_port = physical_port self.major = 0 ...
mithro/chromium-infra
infra/services/android_docker/test/containers_test.py
containers_test.py
py
10,531
python
en
code
0
github-code
6
30798123556
# -*- coding: UTF-8 -*- # ็™พๅบฆไบบ่„ธ่ฏ†ๅˆซ๏ผšhttps://ai.baidu.com/ai-doc/FACE/ek37c1qiz#%E4%BA%BA%E8%84%B8%E6%A3%80%E6%B5%8B from aip import AipFace from config import BAIDU_ID, BAIDU_KEY, BAIDU_SECRET_KEY ''' ็™พๅบฆไบบ่„ธ่ฏ†ๅˆซ ไผ˜็‚น๏ผšๅฏๅ…่ดนไฝฟ็”จ๏ผŒไธชไบบ่ดฆๆˆท็š„้™ๅˆถไธบ2QPS,ไผไธš่ดฆๆˆท็š„้™ๅˆถไธบ10QPS ''' """ ไฝ ็š„ APPID AK SK """ APP_ID = BAIDU_ID API_KEY = BAIDU_KEY SECRET_KEY ...
bobcjxin/rank_face
base_baidu.py
base_baidu.py
py
1,773
python
en
code
0
github-code
6
4640722197
# -*- coding: utf-8 -*- '''This example demonstrates how to extract named entities from text using default model.''' from __future__ import unicode_literals, print_function from pprint import pprint from estnltk import Tokenizer, PyVabamorfAnalyzer, NerTagger text = '''Eesti Vabariik on riik Pรตhja-Euroopas. Eesti ...
keeleleek/estnltk
estnltk/examples/old/ner_tag.py
ner_tag.py
py
945
python
et
code
null
github-code
6
29841696751
# -*- coding: utf-8 -*- """ Created on Tue Feb 8 16:09:50 2022 @author: Owner """ from Hamiltonian import Hamiltonian import numpy as np import math import matplotlib.pyplot as plt import copy from Hamiltonian import Hamiltonian from Fock_vector import fock_vector import Ryser_Algorithm as ryser import config as con...
ahadriaz99/MSci-Project
NonRotatingDisc.py
NonRotatingDisc.py
py
16,186
python
en
code
0
github-code
6
34001792552
words_dict = {'proper' : '์ ์ ˆํ•œ', 'possible' : '๊ฐ€๋Šฅํ•œ', 'moral' : '๋„๋•์ ์ธ', 'patient' : '์ฐธ์„์„ฑ ์žˆ๋Š”', 'balance' : '๊ท ํ˜•', 'perfect' : '์™„๋ฒฝํ•œ', 'logical' : '๋…ผ๋ฆฌ์ ์ธ', 'legal' : 'ํ•ฉ๋ฒ•์ ์ธ', 'relevant' : '๊ด€๋ จ ์žˆ๋Š”', 'responsible' : '์ฑ…์ž„๊ฐ ์žˆ๋Š”', 'regular' : '๊ทœ์น™์ ์ธ'} # correct : ์ •ํ™•ํ•œ -> in ์„ ๋ถ™์—ฌ์„œ ๋ฐ˜๋Œ“๋ง์„ ๋งŒ๋“ ๋‹ค(incorrect) # ์•„๋ž˜์˜ ๊ฒฝ์šฐ์—๋Š” in์ด ์•„๋‹ˆ๋ผ ๋ณ€ํ™”ํ˜•์ด ์•ž์— ๋ถ™๊ฒŒ ๋œ๋‹ค. #...
jinmoonJ/algorithm
0726/05_05_t.py
05_05_t.py
py
2,135
python
ko
code
0
github-code
6
14076978576
''' Write a python server program that 0. initialized a socket connection on localhost and port 10000 1. accepts a connection from a client 2. receives a "Hi <name>" message from the client 3. generates a random numbers and keeps it a secret 4. sends a message "READY" to the...
koterupanchajanyareddy/KPJ
guessing_server/guessing_server.py
guessing_server.py
py
1,956
python
en
code
0
github-code
6
3492737799
"""Provides functional layers for the model""" import numpy as np import torch import torch.nn.functional as F from common_types import Tensor, Union, _float, _int from torch.types import Device, _size _opt_arg = Union[_int, _size] _opt_tensor = Union[Tensor, None] def conv2d(x: Tensor, weight: Tensor, ...
RashedDoha/meta-drn-pytorch
model/layers.py
layers.py
py
1,647
python
en
code
0
github-code
6