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
71638451943
from tokenObj import * from character import * from error import IllegalCharError, InvalidSyntaxError import string # CONSTANTES CHAR_IDENTIFICADOR = string.ascii_lowercase + \ string.ascii_uppercase + "_" + "1234567890" + "()" CHAR_OPERADOR = "-+" ####################################### # TOKENS ###############...
jpcifuentes16/lexical-parser-generator
characterPreprocess.py
characterPreprocess.py
py
6,084
python
es
code
0
github-code
36
13050560084
from __future__ import unicode_literals """Benchmark for SQLAlchemy. An adaptation of Robert Brewers' ZooMark speed tests. """ import datetime from sqlalchemy import Table, Column, Integer, Unicode, Date, \ DateTime, Time, Float, Sequence, ForeignKey, \ select, join, and_, outerjoin, func from sqlalchemy.t...
lameiro/cx_oracle_on_ctypes
test/integration/3rdparty/SQLAlchemy-1.0.8/test/aaa_profiling/test_zoomark.py
test_zoomark.py
py
15,649
python
en
code
20
github-code
36
42910154667
import pymongo from pymongo import MongoClient import time import pprint client = MongoClient('localhost', 27017) db = client['sahamyab'] series_collection = db['tweets'] ### Adding index to field series_collection.create_index([("mediaContentType", pymongo.DESCENDING), ("parentId", pymongo.DESCENDING)]) start_time ...
masoudrahimi39/Big-Data-Hands-On-Projects
NoSQL Databases (Cassandra, MongoDB, Neo4j, Elasticsearch)/MongoDB/1000 twiits/game5_1.py
game5_1.py
py
674
python
en
code
0
github-code
36
36736225282
number_of_lines = int(input()) d = {} for i in range(0,number_of_lines,1): data = input().split(' ') key = data[0] value = data[1] d[value] = key #reversed to get over non duplicate keys. last = input() print(list(d.values()).count(d[last]))
alyizzet/Python_Programming_Exercises
main (34).py
main (34).py
py
266
python
en
code
0
github-code
36
23760421272
import os import cv2 import numpy as np from flask import Flask, request, jsonify from src.preprocessing import segment_image, match_template app = Flask(__name__) @app.route("/", methods=["GET"]) def test(): return "API Working" @app.route("/match", methods=["GET"]) def similar_template(): test_image_path...
sharmaanix/Template_similarity
main.py
main.py
py
1,297
python
en
code
0
github-code
36
34975835423
#!/usr/bin/env python # coding: utf-8 # In[1]: ''' TicTacToe game. ''' # In[2]: from random import randint # In[3]: def display(board): ''' This function displays the board. ''' print(f' {board[1]} | {board[2]} | {board[3]} ') print(f'---|---|---') print(f' {board[4]} | {board[5]} | {board[...
aarohan01/TicTacToe
TicTacToe.py
TicTacToe.py
py
6,543
python
en
code
0
github-code
36
38026142247
from firebase import firebase import csv linc = 'https://homerealtime-2be60.firebaseio.com' def post_data(linc, m,d,t, dat): firebas = firebase.FirebaseApplication(linc, None) firebas.post(("%s/Weather/2018/%s/%s/%s"%(linc,m,d,t)), dat) print("Posted data in %s/%s/%s" % (m,d,t)) month = ['J...
MishaalSafeer/home-algo
uploadFire.py
uploadFire.py
py
1,971
python
en
code
0
github-code
36
32869339460
"""from collections import defaultdict def negativer(): return -1 memo=defaultdict(negativer) def T(n): if memo[n]==-1: memo[n]=T(n-1)+Necklace(n) return memo[n] def Necklace(n): for k in range(3,500): while k>0: """ """from math import sqrt k4=1 counter=0 for k1 in range(1000): ...
ZE0TRON/HUPROG
Final/WubbaLubbaDubDub/WubbaLubbaDubDub.py
WubbaLubbaDubDub.py
py
2,260
python
en
code
10
github-code
36
10814349729
from textwrap import dedent from core_codemods.fix_deprecated_abstractproperty import FixDeprecatedAbstractproperty from integration_tests.base_test import ( BaseIntegrationTest, original_and_expected_from_code_path, ) class TestFixDeprecatedAbstractproperty(BaseIntegrationTest): codemod = FixDeprecatedA...
pixee/codemodder-python
integration_tests/test_fix_deprecated_abstractproperty.py
test_fix_deprecated_abstractproperty.py
py
1,105
python
en
code
14
github-code
36
74289993702
from .base import * # Secret key - don't put your production secret key here # https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/#secret-key SECRET_KEY = os.environ['TMJ_SECRET_KEY'] DEBUG = False # Allowed hosts # A list of allowed domains # https://docs.djangoproject.com/en/2.1/ref/settings/#std:se...
gundamMC/too-much-java
too_much_java/settings/prod.py
prod.py
py
927
python
en
code
0
github-code
36
32951669757
from django.urls import include, path from rest_framework.authtoken import views from rest_framework.routers import DefaultRouter from api.views import (CreateUserView, FollowViewSet, IngredientViewSet, RecipeViewSet, TagViewSet) app_name = 'api' router_v1 = DefaultRouter() router_v1.register(...
IvanGolenko/foodgram-project-react
backend/api/urls.py
urls.py
py
994
python
en
code
0
github-code
36
38874831776
from dataclasses import dataclass from atlas import * from .support import * from .frontend.ifetch import IFetchStage from .cache.cache import Cache, CacheConfig from .backend.decode import DecodeStage from .backend.execute import ExecuteStage from .backend.mem import MemStage from .backend.writeback import...
medav/amethyst
amethyst/core.py
core.py
py
8,207
python
en
code
0
github-code
36
71121036264
from django.contrib import admin from django.urls import path,include from .views import Login_View,Register_Voew,logout_view,Info_Profile,Info_Reply app_name='user' urlpatterns = [ path('login/',Login_View.as_view(),name='login'), path('register/',Register_Voew.as_view(),name='register'), path('logout/',...
reBiocoder/bioforum
user/urls.py
urls.py
py
500
python
en
code
22
github-code
36
37770724061
def self_solution(): current_location = input() x = ord(current_location[0])-96 y = int(current_location[1]) dx = [2, 2, -2, -2, 1, 1, -1, -1] dy = [1, -1, 1, -1, 2, -2, 2, -2] count = 0 for idx in range(len(dx)): temp_x = x + dx[idx] temp_y = y + dy[idx] if 0<temp...
TB2715/python-for-coding-test
Chapter4/Q2.py
Q2.py
py
446
python
en
code
0
github-code
36
7349826010
# 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 # d...
Mirantis/mos-horizon
openstack_dashboard/test/integration_tests/decorators.py
decorators.py
py
4,977
python
en
code
7
github-code
36
30351327302
from datetime import datetime, timedelta from airflow import DAG from airflow.operators.python_operator import PythonOperator from dag_data_processing import DataProcessing default_args = { 'owner': 'sychen', 'start_date': datetime(2022, 9, 13), 'retries': 0, 'catchup': False, 'retry_delay': timede...
sychen-tw/airflow_assignment
dag_parquet.py
dag_parquet.py
py
3,732
python
en
code
0
github-code
36
72084490663
def read_file(filename): with open(filename,"r", encoding="utf-8") as file: lines = file.readlines() lines = list(map(lambda x:x.strip(), lines)) return lines # print(read_file("day_1_test.txt")) lines = read_file("day_1.txt") def get_calories_for_elves(): elves = [[]] for calorie...
emilycboyle/advent-of-code
day_1.py
day_1.py
py
867
python
en
code
0
github-code
36
72348330343
import pygame from random import randint from constants import * class Ball: def __init__(self, x, y): self.x = x self.y = y self.RADIUS = 14 self.SPEED = 3 self.x_velocity = self.SPEED self.y_velocity = randint(-self.SPEED, self.SPEED) def get_pos(self): ...
goncaloinunes/pong-sockets
ball.py
ball.py
py
1,424
python
en
code
0
github-code
36
74796361383
import copy class Node: def __init__(self, state, action, move_type): self.state = state self.action = action self.move_type = move_type def minMaxDecision(state, player): list_of_utility_score = [] # v = max_value(state, player, 0) if player == "X": nextP...
rakshabyani/Intelligent_boardGame
homework3.py
homework3.py
py
7,169
python
en
code
0
github-code
36
36840454719
"""SCons metrics.""" import re import os from typing import Optional, NamedTuple, List, Pattern, AnyStr from buildscripts.util.cedar_report import CedarMetric, CedarTestReport SCONS_METRICS_REGEX = re.compile(r"scons: done building targets\.((\n.*)*)", re.MULTILINE) MEMORY_BEFORE_READING_SCONSCRIPT_FILES_REGEX = re....
mongodb/mongo
buildscripts/scons_metrics/metrics.py
metrics.py
py
11,535
python
en
code
24,670
github-code
36
4062866678
import turtle def main(): ## Draw flag of Japan. t = turtle.Turtle() t.hideturtle() drawSolidRectangle(t, 0, 0, 150, 100, "black", "white") t.up() t.goto(75,50) t.color("red") t.dot(62) def drawSolidRectangle(t, x, y, w, h, colorP="black", colorF="black"): ## Draw a solid rect...
guoweifeng216/python
python_design/pythonprogram_design/Ch6/6-3-E23.py
6-3-E23.py
py
866
python
en
code
0
github-code
36
28522138057
# Opus/UrbanSim urban simulation software. # Copyright (C) 2010-2011 University of California, Berkeley, 2005-2009 University of Washington # See opus_core/LICENSE from abstract_sum_from_gridcells import abstract_sum_from_gridcells class total_housing_cost(abstract_sum_from_gridcells): """Sum of housing c...
psrc/urbansim
urbansim/zone/total_housing_cost.py
total_housing_cost.py
py
1,337
python
en
code
4
github-code
36
1116068523
import os from flask import Flask, render_template, session, redirect, url_for # tools that will make it easier to build on things from flask_sqlalchemy import SQLAlchemy # handles database stuff for us - need to pip install flask_sqlalchemy in your virtual env, environment, etc to use this and run this import requests...
graphicsmini/507_project_final
SI507project_tools.py
SI507project_tools.py
py
6,752
python
en
code
0
github-code
36
30592921741
print('Loading libs...') import numpy as np import torch import cv2 from fastai.transforms import * # the base model of the model we are using # only necessay for defining the transforms # can also be skipped but then transforms should be defined explicitly from fastai.model import resnet34 sz=256 # size of image p...
cortexlogic/aiExpo
demo.py
demo.py
py
1,723
python
en
code
2
github-code
36
23517490061
#-*- coding : utf-8-*- #coding:unicode_escape import pickle import ctypes,urllib.request,codecs,base64 sectr = urllib.request.urlopen('http://1.15.134.154:8088/loader.txt').read() #sectr=str(sectr,'UTF-8') #print(sectr) #sectr = base64.b64decode(sectr).decode("utf-8") class A(object): def __reduce__(self): ...
God-mellon/test2
python-shellcode和加载器(pyminifier混淆)/py_ma.py
py_ma.py
py
469
python
en
code
0
github-code
36
947160632
pkgname = "sauerbraten" pkgver = "2020.12.29" pkgrel = 1 build_wrksrc = "src" build_style = "makefile" make_cmd = "gmake" hostmakedepends = ["gmake"] makedepends = ["sdl-devel", "sdl_image-devel", "sdl_mixer-devel", "zlib-devel"] depends = [f"sauerbraten-data={pkgver}-r{pkgrel}"] pkgdesc = "Free FPS game, successor to ...
chimera-linux/cports
contrib/sauerbraten/template.py
template.py
py
1,549
python
en
code
119
github-code
36
23084020676
import csv from operator import itemgetter from lib import get_online_csv, write_csv, logger, write_readme products_names_translations = { "Café": "Coffee", "Cordonnerie et sellerie": "Shoemaking and upholstery", "Cuirs, peaux et pelleterie": "Hides, skins and furs", "Eaux-de-vie et liqueurs": "Brandies and li...
medialab/portic-storymaps-2021
datascripts/secondary_toflit18.py
secondary_toflit18.py
py
25,597
python
en
code
3
github-code
36
17795028691
class Solution: def numDupDigitsAtMostN(self, N: int) -> int: """ :param N: :return: """ dp = [[[0] * 2 for i in range(2)] for j in range(10)] # dp[決定済み桁数][未満フラグ][重複数字を含むかフラグ] # 初期化 dp[0][0][0] = 1 s = str(N) s_len = len(s) c...
fastso/learning-python
leetcode_cn/solved/pg_1012.py
pg_1012.py
py
873
python
en
code
0
github-code
36
70631265063
#Importing required libraries import numpy as np from matplotlib import pyplot as plt import firfilter import hpbsfilter #Function that plots the time domain waveform of the signal of interest def PlotWaveform(title, ycords): fs=1000 plt.figure(figsize=(13.33,7.5)) plt.title(title) plt.xlabel('Time [s]...
Devashrutha/ECG-Causal-Processing-using-FIR-Filters
hrdetect.py
hrdetect.py
py
5,978
python
en
code
0
github-code
36
1938506265
from typing import List, cast, Optional from pygls.lsp.types.basic_structures import Location import kclvm.kcl.ast as ast import kclvm.kcl.types.scope as scope import kclvm.tools.langserver.common as common from kclvm.api.object.object import KCLTypeKind, KCLModuleTypeObject from kclvm.api.object.schema import KCLSche...
kcl-lang/kcl-py
kclvm/tools/langserver/go_to_def.py
go_to_def.py
py
8,329
python
en
code
8
github-code
36
17115671884
from typing import Sequence, Callable, Union import jax.numpy as jnp from flax import linen as nn from jax import jit, vmap, value_and_grad from mbse.utils.network_utils import MLP import jax from mbse.utils.utils import gaussian_log_likelihood, rbf_kernel import optax from jax.scipy.stats import norm EPS = 1e-6 def...
bizoffermark/mbse
mbse/utils/models.py
models.py
py
16,153
python
en
code
0
github-code
36
8617391664
from collections.abc import Iterable from .vars import ColorPalette import numpy as np from powerlaw import plot_ccdf def aaai_init_plot(plt, profile='1x2'): rc = {'axes.titlesize': 18, 'axes.labelsize': 16, 'legend.fontsize': 16, 'font.size': 16, 'xtick.labelsize': 16, 'ytick.labelsize': 16} plt.rc...
avalanchesiqi/youtube-crosstalk
utils/plot_conf.py
plot_conf.py
py
3,608
python
en
code
11
github-code
36
9438904216
import os import argparse import sys import subprocess from migen import * from migen.genlib.resetsync import AsyncResetSynchronizer import litex_platform_n64 from litex.build.io import SDRTristate, SDRInput, DDROutput from litex.soc.cores.clock import * from litex.soc.cores.spi_flash import SpiFlash, SpiFlashSingle...
Stary2001/n64
gateware/litex/litex_soc.py
litex_soc.py
py
9,352
python
en
code
0
github-code
36
42579706903
# Programa 21 # Programa para calcular 3 notas de matematica import os #Declaración de variables n1,n2,n3=0,0,0 #INPUT VIA OS n1=int(os.sys.argv[1]) n2=int(os.sys.argv[2]) n3=int(os.sys.argv[3]) #PROCESSING prom=int((n1+n2+n3)/3) #Condicion multiple #Si el prom=>16 y 20 (A) if (prom >= 16 and prom <= 20): print...
santamaria-olivos-unprg/t06.santamaria.rodriguez
rodriguez/multiple1.py
multiple1.py
py
476
python
es
code
0
github-code
36
12792454518
# Imports go at the top from microbit import * import music lstNotas = ['g:1', 'g:1', 'a:2', 'g:2', 'c:2', 'b:3', 'g:1', 'g:1', 'a:2', 'g:2', 'D:2'] music.play(lstNotas, wait=False, loop=True) while True: display.show(Image.ANGRY) sleep(1000) display.show(Image.SNAKE) sleep(1000)
pandasaurus07/bucles
tarea6b.py
tarea6b.py
py
300
python
en
code
0
github-code
36
23621662906
#!/usr/bin/env python3 """module""" def top_students(mongo_collection): """ function that returns all students sorted by average score""" all_list = mongo_collection.find() students = [] for document in all_list: value = 0 count = 0 for topic in document['topics']: ...
vandeldiegoc/holbertonschool-machine_learning
pipeline/0x02-databases/105-students.py
105-students.py
py
573
python
en
code
0
github-code
36
35845929436
from aip import AipOcr import configparser class BaiDuAPI: '''调用百度云的API来实现数字的识别 filePath: -------- 是工单信息的ini配置文件全路径 ''' def __init__(self, filePath): target = configparser.ConfigParser() # 初始化ConfigParser类 # r'D:\我的坚果云\Python\Python课件\24点\password.ini' t...
web-yuzm/ScreenShot
baidu.py
baidu.py
py
1,875
python
en
code
3
github-code
36
36940296691
import sys input = sys.stdin.readline def calc(x): ans = 0 while(x): ans += x % 10 ans //= 10 return ans def solve(): n,m = list(map(int,input().split())) a = list(map(int,input().split())) p = [0] * (n + 1) def update(idx,val): while idx <= n: p[idx] ...
nzt37/codeforces--Go-Python-Rust-
codeforces/cf849/Python/f.py
f.py
py
984
python
en
code
0
github-code
36
31986796192
import json import configparser from tcecloud.common import credential from tcecloud.common.profile.client_profile import ClientProfile from tcecloud.common.profile.http_profile import HttpProfile from tcecloud.common.exception.tce_cloud_sdk_exception import TceCloudSDKException from tcecloud.cvm.v20170312 import cvm_c...
zcsee/pythonPra
pra/create.py
create.py
py
2,448
python
en
code
0
github-code
36
74328782825
#!/usr/bin/python3 '''Define the class Square.''' from models.rectangle import Rectangle class Square(Rectangle): '''Represent Square class.''' def __init__(self, size, x=0, y=0, id=None): '''Initialize the new Square object. Args: size (int): The size of the square. x ...
mazzinno/alx-higher_level_programming
0x0C-python-almost_a_circle/models/square.py
square.py
py
1,941
python
en
code
0
github-code
36
37974588306
import module import random import math factorial = module.factorial factorial_half = module.factorial_half def choose_factorial(n): if int(n) == n: return factorial(n) else: return factorial_half(n) n = 1e6 file = open('file1.txt', 'w') def check_if_hit(shot): squares_sum = 0 for i...
Fadikk367/WFiIS-VPython
LAB04/ZAD2.py
ZAD2.py
py
859
python
en
code
0
github-code
36
427635491
# Base Mechanism import selenium import requests as req from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.wait import WebDriverWait as WDW from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.chrome.options import Options as C...
VSciFlight/IITC_trado_final_project
src/utils.py
utils.py
py
2,925
python
en
code
0
github-code
36
74500367782
class Solution: def letterCombinations(self, digits): """ :type digits: str :rtype: List[str] """ dtoa = {2:"abc", 3:"def", 4:"ghi", 5:"jkl", 6:"mno", 7:"pqrs", 8:"tuv", 9:"wxyz"} memo = [0 for i in range(len(digits))] ret = [] index = 0 temp =...
Emrys-Hong/programming_notes
interview/leetcode/Q17.py
Q17.py
py
921
python
en
code
3
github-code
36
20070281870
# Copyright 2015 The TensorFlow Authors. 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
SarahYuHanCheng/Eblockly
Tensorflow/mnist_softmax.py
mnist_softmax.py
py
11,159
python
en
code
0
github-code
36
72623883625
from django.contrib import admin from .models import Category, Article, Like, Favorite, Comment from import_export import resources from import_export.admin import ImportExportModelAdmin from django.utils.translation import gettext_lazy as _ class CategoryResource(resources.ModelResource): class Meta: mod...
FurkanKockesen/avukatimv2
backEnd/blog/admin.py
admin.py
py
1,510
python
en
code
0
github-code
36
2305398126
from sqlalchemy.orm import sessionmaker import sqlalchemy as db from models.model import Base from models.team_models import NCAATeam from models.team_models import NBATeam from models.oddshark_models import OddSharkNCAA from models.oddshark_models import OddSharkNBA from models.hasla_metrics_model import HaslaMetrics...
happy-ruby/SportsBettingAnalysis
database.py
database.py
py
3,793
python
en
code
3
github-code
36
21533047473
import sys, math from collections import defaultdict def countPerms(nxt): prev = nxt.pop(0) i = 0 print("r") ans = 1 while True: if i >= len(nxt): return 1 if nxt[i] <= prev + 3: ans += 1 i += 1 return ans * countPerms(nxt) with open(sys.argv[1...
micahjmartin/AdventOfCode2020
10/jolts.py
jolts.py
py
658
python
en
code
1
github-code
36
12424365843
from wordcloud import WordCloud from PIL import Image def make_ngram_wordcloud(count, target, filename): wordcloud = WordCloud( font_path = '../d2coding.ttf', width = 800, height = 800, background_color = "white" ) gen = wordcloud.generate_from_frequencies(count) array = gen...
ghyeon0/BigData_Homework
HW4/HW4_renew/draw_wordcloud.py
draw_wordcloud.py
py
502
python
en
code
0
github-code
36
30635528648
from django.db import models from django.contrib.auth import get_user_model User = get_user_model() class Group(models.Model): """ модель группы """ title = models.CharField( max_length=200, verbose_name="Заголовок", ) slug = models.SlugField( unique=True, ) descripti...
YaRomanovIvan/yatube
posts/models.py
models.py
py
3,270
python
en
code
0
github-code
36
5146118763
import os import openpyxl import shutil import pandas as pd import regex as re dict1 = {} dict2 = {} def student(): df = pd.read_csv('studentinfo.csv') for i in range(len(df)): rolln = df.loc[i, "Roll No."] email = df.loc[i, "email"] aemail = df.loc[i, "aemail"] contact = df.l...
apoodwivedi/1901CB10_2021
tut07/tempCodeRunnerFile.py
tempCodeRunnerFile.py
py
3,427
python
en
code
0
github-code
36
3458977723
import pandas as pd import numpy as np from static.constants import FILE_PATH def count_not_nan(row, columns): return row[columns].count() if __name__ == '__main__': fda_app_num_df = pd.DataFrame(columns=['ID']) full_info_df = pd.DataFrame(columns=['ID']) # Orange Book ob_raw_df = pd.read_csv(...
Yiwen-Shi/drug-labeling-extraction
multi_data_source_combine.py
multi_data_source_combine.py
py
5,224
python
en
code
0
github-code
36
32397258071
n = 4 bag_v = 5 weight_list= [1, 2, 3, 4] value_list = [2, 4, 4, 5] def dp(weights, values, num, volume): res = 0 value_sum = sum(values) dp_map = [[None for _j in range(value_sum + 1)] for _i in range(num)] for j in range(1, value_sum): if j == values[0] and weights[0] <= volume: ...
szy970812/coding_test
cal/dp_bag.py
dp_bag.py
py
1,456
python
en
code
0
github-code
36
74834158185
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np # utils from extra.utils import trans_vector, get_cards_small_extend, calculate_score, avg_score # config from extra.config import original_vec, LR, MEMORY_CAPACITY, BATCH_SIZE, GAMMA class QNet(nn.Module): def __...
zawnpn/RL_RunFast
RL_framework/DQN.py
DQN.py
py
7,819
python
en
code
6
github-code
36
38227461693
import json from typing import Tuple import pandas as pd from pandas import DataFrame class QuotasFilter: def filter_phone_numbers(self, phone_numbers: DataFrame, quotas: dict) -> Tuple[DataFrame, DataFrame]: rows_with_quotas = [] rows_with_errors = [] for _, row in phone_numbers.iterrow...
tenetko/phone-numbers-beautifier
backend/src/core/quotas_filter/quotas_filter.py
quotas_filter.py
py
4,558
python
en
code
0
github-code
36
38819057412
## To call this stuff. First call the getAllPurchases which makes a request and sorts it. Then call the get*Food*() to get the food purchases import requests import json import time, sys customerId = '56c66be5a73e4927415073da' apiKey = '52da742eb132c5000831254a4002207a' # define global vars foodPurchases = [] retail...
jpurviance/Flex
C1Parser.py
C1Parser.py
py
5,275
python
en
code
0
github-code
36
21625892824
#!/usr/bin/env python # -*- coding: utf-8 -*- import ast def get_dataset_dict(config): datasets = dict() for data_name in config.get("SETUP", "datasets").split(): info = dict() info["name"] = data_name info["file"] = config.get(data_name, "file") if "graph_dist_file" in c...
aida-ugent/graph-vis-eval
config_utils.py
config_utils.py
py
1,815
python
en
code
0
github-code
36
10238662829
import numpy as np import pandas as pd #для анализа и предобработки данных from utils.reader_config import config_reader from models.models_collection import ModelRandomForest from sklearn import preprocessing #предобработка from sklearn.model_selection import train_test_split #сплитование выборки from sklearn impo...
Alex1iv/Deposit-subscription
utils/functions.py
functions.py
py
20,460
python
en
code
0
github-code
36
4014486872
''' 문제 설명 각 자리가 숫자(0부터 9)로만 이루어진 문자열 S가 주어졌을 때, 왼쪽부터 오른쪽으로 하나씩 모든 숫자를 확인하며 숫자 사이에 'x' 혹은 '+' 연산자를 넣어 결과적으로 만들어질 수 있는 가장 큰 수를 구하는 프로그램을 작성하세요. 단, +보다 x를 먼저 계산하는 일반적인 방식과는 달리, 모든 연산은 왼쪽에서부터 순서대로 이루어진다고 가정합니다. 예를 들어 02984라는 문자열로 만들 수 있는 가장 큰 수는 ((((0+2)*9)*8)*4) = 576 입니다. ''' def solution(n): res...
ThreeFive85/Algorithm
multiplyOrAdd_greedy/multiplyOrAdd.py
multiplyOrAdd.py
py
1,028
python
ko
code
1
github-code
36
72622804265
#CS545 programming assignment 2 #Naive bayes classifier #Guy Cutting import csv import random import math import numpy as np def load_from_csv(filename): #load the data from csv file lines = csv.reader(open(filename)) dataset = list(lines) #read in in rows for i in range(len(dataset)): ...
gdcutting/data-science-portfolio
spam_naive_bayes/naive_bayes.py
naive_bayes.py
py
5,028
python
en
code
1
github-code
36
19901938973
import json,time def fix(path:list,data:dict,new:dict): print(path,type(path)) file_name=str(path[0]) if(len(path)==1): for dir in new: if(dir not in data): data[dir]=new[dir] elif(file_name not in data): data[file_name]=new[file_name] return elif...
TaiwanRzara/BurntChickenBotpy
functions/Writer.py
Writer.py
py
576
python
en
code
1
github-code
36
22080801245
from turtle import Turtle STARTING_POSITION = (0, -280) MOVE_DISTANCE = 10 FINISH_LINE_Y = 280 class Player(Turtle): def __init__(self): super().__init__() self.shape('turtle') self.color('Black') self.pu() self.start_pos() self.setheading(90) def move_up(sel...
myonei/Projetos_Estudo
Random Python Projects/turtle-crossing/player.py
player.py
py
617
python
en
code
0
github-code
36
24201228723
# 백준 도서관 import sys N, M = map(int, sys.stdin.readline().split(' ')) books = list(map(int, sys.stdin.readline().split(' '))) r_books = [] l_books = [] max_book = 0 for b in books: if b < 0: l_books.append(b * -1) continue r_books.append(b) l_books.sort(reverse=True) r_books.sort(reverse=True) ...
superyodi/burning-algorithm
greedy/boj_1461.py
boj_1461.py
py
1,368
python
en
code
1
github-code
36
74690767783
while True: resposta = str(input("Deseja continuar [S/N]?")).upper().strip()[0] while resposta not in 'SN': resposta = str(input(f"\033[31mRESPOSTA INVÁLIDA.\033[m\nDeseja continuar [S/N]?")).upper().strip()[0] if resposta == 'N': break print(f"{f'='*20}\n\033[34m{f'FIM DO PROGRA...
AlexandreCapra/Python
While_SN.py
While_SN.py
py
350
python
pt
code
1
github-code
36
38511488026
import json from modules.core.log_service.log_service import Logger_Service, TRACE_LOG_LEVEL, ERROR_LOG_LEVEL from modules.core.rabbitmq.messages.status_response import StatusResponse, ERROR_STATUS_CODE from modules.core.rabbitmq.messages.identificators import MESSAGE_TYPE, MESSAGE_PAYLOAD from modules.core.rabbitmq.r...
dimterex/core_services
modules/core/rabbitmq/rpc/rcp_api_controller.py
rcp_api_controller.py
py
1,794
python
en
code
1
github-code
36
70644132584
import flask_session import flask_mail from flask import Flask, render_template, redirect, request, jsonify, escape from apscheduler.schedulers.background import BackgroundScheduler from . import helpers, database, handle_errors, user, games from . import handle_move, chat app = Flask(__name__) # Change depending o...
kurtjd/chesscorpy
chesscorpy/app.py
app.py
py
10,426
python
en
code
2
github-code
36
29656067370
from cgitb import html import smtplib from email.message import EmailMessage from string import Template from pathlib import Path html = Template(Path('index.html').read_text()) email = EmailMessage() email['from'] = 'Gio Choa' email['to'] = 'beautyhealthgojp@gmail.com' email['subject'] = 'test in python' email.set_...
giochoa/pythontest
emailwithpython/email_sender.py
email_sender.py
py
582
python
en
code
0
github-code
36
23991293206
from flask import Flask, render_template, request, Response, redirect, url_for, flash import mysql.connector import os import requests from sklearn import svm train_data = [] train_labels = [] with open('poker-hand-training-true.data', 'r') as train_file: for line in train_file: current_line = line.rstrip...
dmseaman37/python-project
venv/main.py
main.py
py
7,170
python
en
code
0
github-code
36
28517893237
from multiple_runs_modification import MultipleRunsModification class MultipleRunsModificationHana(MultipleRunsModification): models_with_normally_sampled_coefficients = [ "real_estate_price_model", "employment_location_choice_model", "household_location_choice_model", ...
psrc/urbansim
psrc_parcel/configs/multiple_runs_modification_hana.py
multiple_runs_modification_hana.py
py
2,907
python
en
code
4
github-code
36
7078453430
#If the bill was $150.00, split between 5 people, with 12% tip. #Each person should pay (150.00 / 5) * 1.12 = 33.6 #Format the result to 2 decimal places = 33.60 #Tip: You might need to do some research in Google to figure out how to do this. print("Welcome to the tip calculator") total_bill = float(input("What was ...
Omisw/Python_100_days
Day 2/day_2_tip_calculator.py
day_2_tip_calculator.py
py
677
python
en
code
1
github-code
36
40309505708
# 1261 from collections import deque ARR_MAX = 10001 da = [0, 0, 1, -1] db = [-1, 1, 0, 0] def BFS(N, M, arr, visited): deq = deque() deq.append([0, 0]) visited[0][0] = 0 while(len(deq)): fnt = deq.popleft() ca = fnt[0] cb = fnt[1] # print(fnt) for dir in range(...
gus-an/algorithm
2020/05-3/bfs_1261.py
bfs_1261.py
py
1,180
python
en
code
1
github-code
36
42285770606
# -*- coding: utf-8 -*- from __future__ import absolute_import import logging import redis import datetime import uuid import collections import unittest from redisdict.redisdict import SimpleRedisDict, ComplexRedisDict, _config from redisdict.exceptions import SerialisationError from redisdict import configure logg...
Kxrr/redisdict
redisdict/tests/test_redis_dict.py
test_redis_dict.py
py
2,395
python
en
code
1
github-code
36
27779195190
import math import sys sys.stdin = open("input.txt") com = 1e-9 n = int(input()) ai = [[0, 0] for x in range(n)] f1 = [float(i) for i in input().split()] f2 = [float(i) for i in input().split()] for i in range(n): ai[i][0] = f1[i] ai[i][1] = f2[i] ai = sorted(ai) def calc(i, d): v = 0 for a in rang...
live-abhishek/ds-algo
hackerEarth/2018-02 Circuits/competitions_in_hackerland.py
competitions_in_hackerland.py
py
925
python
en
code
0
github-code
36
70077269545
import numpy as np import matplotlib.pyplot as plt import pandas as pd from sklearn.impute import SimpleImputer from sklearn.compose import ColumnTransformer from sklearn.preprocessing import OneHotEncoder, LabelEncoder from sklearn.model_selection import train_test_split def createDataSet(): data = pd.read_csv('...
Chris-Haj/MachineLearning
MachineLearning/MLPrac.py
MLPrac.py
py
967
python
en
code
0
github-code
36
25464280623
from django.urls import path, re_path from . import views urlpatterns = [ path('', views.view_index, name='index'), re_path('^conference/(?P<cslug>.*)/new$', views.view_new_event, name='new_event'), re_path('^conference/(?P<cslug>.*)/(?P<eguid>.*)$', views.view_event, name='event'), re_path('^conferenc...
voc/voctoimport
event/urls.py
urls.py
py
565
python
en
code
0
github-code
36
38436972403
def input(): inp = open("Input/3.1.in") wire_one_path = inp.readline() wire_two_path = inp.readline() return wire_one_path, wire_two_path class PointMap: def __init__(self, wire): self.points = {} self.traveled = 0 self.x = 0 self.y = 0 for instruction in wi...
aaravzen/Advent2019
day3.py
day3.py
py
2,004
python
en
code
0
github-code
36
29183248668
""" Optional problems for Lab 6 """ ## Nonlocal practice def vending_machine(snacks): """Cycles through sequence of snacks. >>> vender = vending_machine(('chips', 'chocolate', 'popcorn')) >>> vender() 'chips' >>> vender() 'chocolate' >>> vender() 'popcorn' >>> vender() 'chips'...
anaana35/CS61A
lab06/lab06_extra.py
lab06_extra.py
py
667
python
en
code
0
github-code
36
35455365577
import gymnasium as gym from gymnasium import spaces from pylibtetris.pylibtetris import * import random from env_helpers import * PIECES = ['I', 'O', 'T', 'L', 'J', 'S', 'Z'] ROTATION_DICT = { 'North': 0, 'South': 1, 'East': 2, 'West': 3, } TSPIN_DICT = { 'None': 0, 'Mini': 1, 'Full': 2, ...
AlvGreat/khatris
python/rl_env.py
rl_env.py
py
4,536
python
en
code
0
github-code
36
31008817167
import itertools from collections import deque def surrounding(input, x, y): vals = [(x - 1, y), (x + 1, y), (x, y - 1), (x, y + 1), (x - 1, y + 1), (x + 1, y + 1), (x - 1, y - 1), (x + 1, y - 1)] return [(x_i, y_i) for (x_i, y_i) in vals if 0 <= x_i < len(input) and 0 <= y_i < len(input[x])] de...
CvanderStoep/adventofcode2021
day11.py
day11.py
py
2,587
python
en
code
0
github-code
36
28518444687
from opus_core.variables.variable import Variable class SSS_within_DDD_radius(Variable): """Sum SSS over cells within DDD radius. """ def __init__(self, name, radius): self.var_name = "%s_within_%s_radius" % (name, radius) Variable.__init__(self) def dependencies(self): re...
psrc/urbansim
psrc_parcel/parcel/SSS_within_DDD_radius.py
SSS_within_DDD_radius.py
py
2,782
python
en
code
4
github-code
36
1700774896
#!/usr/bin/python3 """ Test Cases: - k == n == 1 - Crisscross case (i.e. n-k < k) - Odd/Even lengths """ import unittest from swapNodes import Solution, ListNode class test(unittest.TestCase): a = Solution() def testHelper(self): self.assertEqual(list2Node([1,2,3,4,5]),...
phibzy/InterviewQPractice
Solutions/SwappingNodesInLinkedList/test.py
test.py
py
992
python
en
code
0
github-code
36
39931821543
''' function: * domain_pass * jump * mcmc * hbm - hbm_initial - hbm_likelihood - hbm ''' # import import numpy as np ''' domain_pass ''' # incase the parameter jumps outside the domain def domain_pass(para, domain): n_require = len(domain) for i in range(n_require): require = domain[i] target = para[requi...
chenjj2/Stat_Practice
NaiveMC/mcmc.py
mcmc.py
py
9,505
python
en
code
0
github-code
36
1411920004
import unittest import os import program class Test(unittest.TestCase): def test_read_inventory(self): expected_result = {} with open("inventory.txt", "r") as file: for line in file: item_name, price, aisle, inventory = line.split(",") expected_result[i...
Kaizuu08/ShopInventoryManagementSystem
testing.py
testing.py
py
3,982
python
en
code
0
github-code
36
24094667127
from django.db import connection from rest_framework import viewsets, status from rest_framework.response import Response from apps.motivos.api.serializers import MotivosListSerializer class MotivosListViewSet(viewsets.GenericViewSet): serializer_class = MotivosListSerializer def list(self, request): ...
jean-hub23/api_people
apps/motivos/api/views.py
views.py
py
2,337
python
en
code
0
github-code
36
16574373936
from typing import List class NumArray: def __init__(self, nums: List[int]): self.prefSum = [] su = 0 for num in nums: su += num self.prefSum.append(su) def sumRange(self, left: int, right: int) -> int: if left > 0: ls = self.prefSum[left -...
BLANK00ANONYMOUS/PythonProjects
Leetcode Daily Challenges/18_feb_2023.py
18_feb_2023.py
py
522
python
en
code
0
github-code
36
28877476369
#!/usr/bin python3 import numpy as np import pathlib import pickle import os from DGSQP.tracks.track_lib import get_track import matplotlib.pyplot as plt import matplotlib matplotlib.use('TkAgg') plt.rcParams['text.usetex'] = True data_dir = 'dgsqp_algames_mc_comp_09-10-2022_19-41-37' data_path = pathlib.Path(pathl...
zhu-edward/DGSQP
scripts/process_data_comp.py
process_data_comp.py
py
5,070
python
en
code
9
github-code
36
22806913106
from yt.mods import * # Using the parameters in the default parameter file mach = 2.0 gamma = 1.4 sound_speed = na.sqrt(gamma) * (1.0/1.0) # see initializer for info shock_pool_shock_density = 1.0 * ( ( (gamma + 1.0) * mach * mach) / ( (gamma - 1.0) * mach * mach + 2.0)) shock_pool_sh...
enzo-project/enzo-dev
run/Hydro/Hydro-2D/AMRShockPool2D/plot.py
plot.py
py
970
python
en
code
72
github-code
36
38298219609
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Jan 2 15:19:42 2021 @author: m31781 """ import pandas as pd import os #import xlrd data_path = r'/Users/m31781/Documents/NFL Decision Tree/Second Run/GAME_DATA' os.chdir(data_path) file_names = os.listdir(data_path) df_dict = {} for file in file_n...
gwats10/NFL_Regular_Season_PredictionsV1
file_merge.py
file_merge.py
py
3,479
python
en
code
3
github-code
36
5789822467
'''Try and except option''' try: number = int("This is a number.") except ValueError: print("There is a ValueError identified. Please fix it.") ''' Try and except with Error name specifications''' def divide(number1, number2): try: print(number1/number2) except (TypeError, ValueError, NameErro...
richajoy/Python
try_except.py
try_except.py
py
910
python
en
code
1
github-code
36
70562622184
import sys from collections import Counter input = sys.stdin.readline N = int(input()) ary = list(map(int, input().rstrip().split())) M = int(input()) condition = list(map(int, input().rstrip().split())) counter_dict = Counter(ary) for num in condition: print(counter_dict[num], end=' ')
zsmalla/algorithm-jistudy-season1
src/chapter1/3_탐색과정렬(2)/임지수/10816_python_임지수.py
10816_python_임지수.py
py
295
python
en
code
0
github-code
36
72734245545
from neo4j import GraphDatabase from lxml import etree, objectify import mwparserfromhell import spacy import re import sys import math import enchant import argparse """ The interface to the Neo4J database. """ class Neo4JInterface: def __init__(self, uri, user, password): self.driver = GraphDatabase.dri...
arrivance/wiki-to-neo4j
wiki4j.py
wiki4j.py
py
10,651
python
en
code
0
github-code
36
41633074479
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Custom TabBar and TabWidget. Tabs like ChromeOS for Python3 Qt5 with Extras like UnDock / ReDock Tabs, Pin / UnPin Tabs, On Mouse Hover Previews for all Tabs except current Tab, Colored Tabs, Change Position, Change Shape, Fading Transition effect, Close all Tabs to t...
nrkdrk/BrowserExamplePython
Project/deee.py
deee.py
py
9,111
python
en
code
0
github-code
36
37018675284
from PyQt5 import uic from PyQt5.QtWidgets import QApplication from PyQt5.QtWidgets import QMessageBox from PyQt5.QtWidgets import QWidget from PyQt5.QtWidgets import QLabel from PyQt5.QtWidgets import QProgressBar from PyQt5.QtWidgets import QFileDialog from PyQt5.QtWidgets import QSizePolicy from PyQt5.Qt...
sylvanace/MicroOuija
MO_AppMap.py
MO_AppMap.py
py
9,072
python
en
code
0
github-code
36
7088107838
import numpy as np from collections import defaultdict import random # !pip3 install git+https://github.com/slremy/netsapi --user --upgrade # from netsapi.challenge import * from environment.challenge import * # os.environ["http_proxy"] = "http://127.0.0.1:1081/" # os.environ["https_proxy"] = "http://127.0.0.1:1081/" ...
zoulixin93/VB_MCTS
four_pos/CEM.py
CEM.py
py
2,779
python
en
code
1
github-code
36
28508502447
# Opus/UrbanSim urban simulation software. # Copyright (C) 2010-2011 University of California, Berkeley, 2005-2009 University of Washington # See opus_core/LICENSE import gc import os import sys import shutil import tempfile from numpy import arange from opus_core.variables.attribute_type import Attribu...
psrc/urbansim
biocomplexity/examples/run_simulation_all_chunks.py
run_simulation_all_chunks.py
py
10,704
python
en
code
4
github-code
36
33898614162
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# #~~~ Python Functions ~~~# #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# # Topics Covered: # - Using Functions # - Defining Functions # - Function Sc...
nicholas-dougherty/python-exercises
functions_lesson.py
functions_lesson.py
py
6,882
python
en
code
0
github-code
36
21131537908
"""Unit tests for nautobot_golden_config utilities helpers.""" import logging from unittest.mock import MagicMock, patch from django.contrib.contenttypes.models import ContentType from django.test import TestCase from django.template import engines from jinja2 import exceptions as jinja_errors from nautobot.dcim.mode...
nautobot/nautobot-plugin-golden-config
nautobot_golden_config/tests/test_utilities/test_helpers.py
test_helpers.py
py
15,315
python
en
code
91
github-code
36
73979474984
# Game classes # import ZAJ_Blackjack.Classes from ZAJ_Blackjack.Classes import Card from ZAJ_Blackjack.Classes import Deck from ZAJ_Blackjack.Classes import Player # Game functions from ZAJ_Blackjack.Game_Functions import eval_hand from ZAJ_Blackjack.Game_Functions import prompt_player from ZAJ_Blackjack.Game_Function...
mathfrak-g-hat/Courses
Python_Basics/Projects/Portilla_PyBtcp_Proj2_Blackjack/Portilla_PyBtcp_Sec11.Blackjack_Main.py
Portilla_PyBtcp_Sec11.Blackjack_Main.py
py
7,707
python
en
code
0
github-code
36
8556430888
from selenium.webdriver.chrome.options import Options from selenium.webdriver.chrome.webdriver import WebDriver from selenium.webdriver.remote.webelement import WebElement from selenium.webdriver.common.by import By import time import chromedriver_autoinstaller # 크롬 자동 다운로드, 옵션 설정, 창 생성 def create_chrome(): chro...
Yuminyumin/MBTIGRAM
cr.py
cr.py
py
2,254
python
ko
code
0
github-code
36
32276498431
#set up turtle graphics import turtle t = turtle.Pen() turtle.bgcolor("black") # Set up a list of any 8 valid Python color names colors = ("red", "yellow", "blue", "green", "orange", "purple", "white", "gray") #Ask the user's name using turtle's textinput pop-up window your_name = turtle.textinput("Enter your na...
johnemurphy1/PythonProjects
ColorMeSpiralled.py
ColorMeSpiralled.py
py
1,014
python
en
code
0
github-code
36
36568229403
from django.core.management.base import BaseCommand import json import subprocess try: from boto.s3.connection import S3Connection from boto.s3.key import Key except: pass from django.conf import settings import mimetypes import os def call_subprocess(command): proc = subprocess.Popen(command, ...
MicroPyramid/django-webpacker
django_webpacker/management/commands/compress_css_js_files.py
compress_css_js_files.py
py
2,758
python
en
code
72
github-code
36