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
43967300296
# Cryptomath Module # http://inventwithpython.com/hacking (BSD Licensed) def gcd(a, b): # Return the GCD of a and b using Euclid's Algorithm while a != 0: a, b = b % a, a return b def succesiveSquaring(base, exp, mod): if exp == 0: x = 1 else: half = succesiveS...
rugbyprof/CMPS-Cryptography
cryptomath.py
cryptomath.py
py
1,424
python
en
code
4
github-code
36
42360576812
""" __title__ = '' __author__ = 'Thompson' __mtime__ = '2018/5/23' # code is far away from bugs with the god animal protecting I love animals. They taste delicious. ┏┓ ┏┓ ┏┛┻━━━┛┻┓ ┃ ☃ ┃ ┃ ┳┛ ┗┳ ┃ ┃ ┻ ┃ ┗━┓ ┏━...
hwzHw/python37
day0109/requests_04_代理IP.py
requests_04_代理IP.py
py
1,014
python
en
code
0
github-code
36
2080670146
# -*- coding : utf-8 -*- import numpy as np import torch from torch import nn class DNN(nn.Module): def __init__(self,args): super().__init__() self.outDim = args.outDim self.seqLen = args.seqLen self.hiddenDim1 = args.hiddenDim1 self.hiddenDim2 = args.hiddenDim2 se...
Ylizin/RWSim
ylSim/DNN.py
DNN.py
py
1,213
python
en
code
2
github-code
36
17881377685
#When newlist = oldlist, both will get modified when one is edited !!!!!!!!!!!!!!!!! nums = [1,2,3,4,5,6,7] k = 3 length = len(nums) temp = nums.copy() def indexRet(index, length, k): newIndexVal = (i+k)%length return newIndexVal for i in range(length): newIndex = indexRet(i, length, k) nums[newIndex] = temp[i...
qdotdash/Competitive_Coding
Data Structures and Algorithms - Udemy/Arrays Exercises/5. shiftArrays.py
5. shiftArrays.py
py
335
python
en
code
0
github-code
36
29647725517
import sqlite3 import pandas as pd import time import sys from drugbank.drugbank_index_query import drugbank_search from hpo.hpo_index_query import hpo_search from omim.omim_index_query import omim_search from stitch.stitch_chemical_sources_index_query import stitch_chemical_sources_search from stitch.stitch_br08303_i...
Hamza-ABDOULHOUSSEN/gmd2k22
python/data_query.py
data_query.py
py
7,485
python
en
code
0
github-code
36
5784254080
from unittest import mock import bson import pytest from test.tools import anything, in_any_order from slivka import JobStatus from slivka.db.documents import JobRequest, ServiceState from slivka.db.helpers import delete_many, insert_many, pull_many from slivka.scheduler import Runner, Scheduler from slivka.scheduler...
bartongroup/slivka
test/scheduler/test_scheduler.py
test_scheduler.py
py
8,266
python
en
code
7
github-code
36
10914202370
#!/usr/bin/env python3 import os import mod_resource import mod_something if __name__ == "__main__": print("Hello, world! -> something returns: {}".format(mod_something.something())) res_path = \ os.path.join(os.path.dirname(mod_resource.__file__), 'resource.txt') with open(res_path) as f: ...
borntocodeRaj/sphinx_configuration
tests/roots/test-apidoc-toc/mypackage/main.py
main.py
py
403
python
en
code
1
github-code
36
28121817798
import tornado.httpserver import tornado.ioloop import tornado.web import tornado.options import settings from handlers import * def make_app(): db = None handlers = [ (r"/", MainHandler), (r"/covert", CovertHandler) ] config = {"template_path":settings.TEMPLATE_PATH, "static_path":settings.ASS...
caroltc/lrc2srt
app.py
app.py
py
672
python
en
code
2
github-code
36
41278650678
# -*- coding: utf-8 -*- """ Created on Sun Sep 8 16:46:19 2019 @author: sanjain6 """ if __name__ == '__main__': s = "abcab" c = 'abc' p = len(s) q = 0 for i in range(len(s) - len(c) + 1): if c in s[i: i + len(c)]: q +=1 print(q) ...
San0506/Use-Cases-Python-String-Manipulation
String_mutate.py
String_mutate.py
py
339
python
en
code
0
github-code
36
12004997372
import socket import os import sys # 第三方库 from 网络 import 创建网络 if __name__ == '__main__': 创建网络.本地服务器地址='127.0.0.1' 创建网络.本地服务器端口=1082 插座= 创建网络.申请插座() print("服务器的socket建立了") 插座.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) 创建网络.绑定插座(插座) print('服务器的socket绑定到%s:%d'%(创建网络.本...
littleguyy/python-practice
http代理原理.py
http代理原理.py
py
1,671
python
zh
code
2
github-code
36
2964066145
#!/bin/python3 import os import sys class Node(object): def __init__(self, n): self.n = n self.neighbors = {} self.feet = 0 def copy(self): n = Node(self.n) n.neighbors = self.neighbors.copy() n.feet = self.feet return n class Graph(object): def _...
jvalansi/interview_questions
crab.py
crab.py
py
3,838
python
en
code
0
github-code
36
11526198960
import asyncio import json import multiprocessing as mp from importlib import import_module from django import http from django.conf import settings from django.core.cache import caches from django.core.handlers.asgi import ASGIRequest from django.contrib import auth from django.utils import timezone from asgiref.syn...
cognitive-space/warpzone
worlds/websocket.py
websocket.py
py
5,411
python
en
code
1
github-code
36
38221958113
class Solution: def spiralOrder(self, matrix: List[List[int]]) -> List[int]: top = 0 bottom = len(matrix) left = 0 right = len(matrix[0]) arr = [] while (top < bottom and left < right): for j in range(left,right): arr.append(matrix[top][j])...
vaibhavTekk/leetcoding
problems/spiral_matrix/solution.py
solution.py
py
782
python
en
code
1
github-code
36
34088291435
from abc import ABC, abstractmethod def process_for_variable(var, table_info): for tableName in table_info.keys(): splited = var.split(tableName) if len(splited)>1: pure_variable = splited[-1][1:] if pure_variable == '': sql = table_info[tableName]['subQuery'...
ajcltm/Isql_v3
Isql/querySql.py
querySql.py
py
12,110
python
en
code
0
github-code
36
74540116904
loadModule('/Capella/Capella') import sys def capella_query(query_class, e_obj, cls = None): """Call a query from the semantic browser from the qualified class name of the query and the EObect to pass as parameter""" res = [] for e in callQuery(query_class, e_obj.get_java_object()): e_object_class ...
kaynl/ROxE
Python4Capella/java_api/Capella_API.py
Capella_API.py
py
1,766
python
en
code
3
github-code
36
71335904423
from os import * from sys import * from collections import * from math import * def findInMatrix(x, arr): # Write your code here ## We know that each column and each row is sorted. ## Let us begin from the Right Top most point row, column = 0, len(arr[0])-1 while row<len(arr) and column>=0: ...
architjee/solutions
CodingNinjas/Search in a 2D matrix II.py
Search in a 2D matrix II.py
py
521
python
en
code
0
github-code
36
70489044264
import pytest from unittest.mock import AsyncMock, patch from api.exceptions import InvalidParameterError from crawler.default.instances.second_instance import SecondInstance # Mock para a resposta do ClientSession mock_response = AsyncMock() mock_response.text.return_value = 'Sample Text' @pytest.mark.asyncio async...
BrunoPisaneschi/JusBrasil
tests/unit/crawler/default/instances/test_second_instance.py
test_second_instance.py
py
921
python
en
code
0
github-code
36
74949364585
import matplotlib.pyplot as plt import numpy as np import torch from torch import nn from RNN_torch.model import RNN # Hyper parameters BATCH_SIZE = 64 EPOCH = 1 TIME_STEP = 28 # 考虑多少个时间点的数据 INPUT_SIZE = 1 # 每个时间点给RNN多少个数据点 LR = 0.01 rnn = RNN(INPUT_SIZE) print(rnn) optimizer = torch.optim.Adam(r...
xjtulyc/PKU_Weekly_Summary_repo
20220719/cs231n assignment/assignment_3.py
assignment_3.py
py
1,352
python
en
code
2
github-code
36
34343311578
'''Write a Python program to count the number of strings where the string length is 2 or more and the first and last character are samefrom a given list of strings.''' def give_str(words): selected_words = [] for word in words: if len(word) > 2 and word[0] == word[-1]: selected_word...
ABDULSABOOR1995/Python-List-Exercises
List Exercises/string_manipulation.py
string_manipulation.py
py
479
python
en
code
2
github-code
36
73037104745
import collections.abc import copy import typing import enpheeph.injections.plugins.indexing.abc.indexingpluginabc import enpheeph.utils.constants import enpheeph.utils.dataclasses import enpheeph.utils.enums import enpheeph.utils.typings class IndexingPlugin( enpheeph.injections.plugins.indexing.abc.indexingplu...
Alexei95/enpheeph
src/enpheeph/injections/plugins/indexing/indexingplugin.py
indexingplugin.py
py
9,122
python
en
code
1
github-code
36
19509126438
import pandas as pd import requests from datetime import datetime DISCORD_URL = "https://discord.com/api/v9/invites/UQZpTQbCT4?with_counts=true" STARTED_AT = datetime.now() request = requests.get(DISCORD_URL) data = request.json() new_dataframe = pd.json_normalize(data, max_level=2) new_dataframe["_started_at"] =...
ndrluis/soberana-data-poc
extract/scripts/discord.py
discord.py
py
566
python
en
code
2
github-code
36
8086245877
#!/usr/bin/env python """ The file contains the class and methods for loading and aligning datasets """ from __future__ import print_function, division import pickle import numpy as np from scipy.io import loadmat import pandas as pd from .utils import p2fa_phonemes import warnings from collections import OrderedDict f...
codeislife99/Multimodal_Emotion_Analysis
mmdata/dataset.py
dataset.py
py
29,605
python
en
code
1
github-code
36
6864404682
import math, random import gym import numpy as np import torch import torch.nn as nn import torch.optim as optim import torch.autograd as autograd import torch.nn.functional as F import matplotlib.pyplot as plt USE_CUDA = torch.cuda.is_available() Variable = lambda *args, **kwargs: autograd.Variable(*args, **kwargs).c...
saumyasinha/learning_better_policies_with_critical_states
Qlearning/dqn_for_CartPole.py
dqn_for_CartPole.py
py
8,842
python
en
code
0
github-code
36
34338165702
# https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/ from typing import List # Definition for a binary tree node. class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class Solution: ...
0x0400/LeetCode
p105.py
p105.py
py
788
python
en
code
0
github-code
36
70955291624
"""add admin flag to user Revision ID: dd535b1f37a1 Revises: 4519159d3019 Create Date: 2019-01-06 13:39:21.042745 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'dd535b1f37a1' down_revision = '4519159d3019' branch_labels = None depends_on = None def upgrade(...
euphwes/cubers.io
migrations/versions/014_dd535b1f37a1_add_admin_flag_to_user.py
014_dd535b1f37a1_add_admin_flag_to_user.py
py
797
python
en
code
27
github-code
36
4084609951
import customtkinter as ctk class ConfirmDeleteOldestBackupDialog(ctk.CTkToplevel): def __init__(self, parent, controller, *args, **kwargs): super().__init__(parent, *args, **kwargs) # Configure variables self.controller = controller self.label_text = "You are only allowed 10 back...
berndklare/flashcards
dialogs/confirm_delete_oldest_backup_dialog.py
confirm_delete_oldest_backup_dialog.py
py
1,389
python
en
code
0
github-code
36
26425057259
#coding: latin-1 # # Exemple 5.5 dimensionnemnt approche suédoise # from geothermal_md import * import numpy as np from matplotlib.pyplot import * from time import * # fichier de fonction g (Eskilson) tabuléees pour champ 2 x 2 pour b = 0.05,0.1,0.2,0.4,0.8 zo = 0 rb = 0.25/2 b = 0.05 H = 4 z = 1.8 Ht = H/rb bt = b/rb...
LouisLamarche/Fundamentals-of-Geothermal-Heat-Pump-Systems
chapter13/Example13_5.py
Example13_5.py
py
2,165
python
en
code
1
github-code
36
5987566968
from django.urls import path from .views import ListingsView, ListingView, SearchView # Declare the URL for the listings app here. urlpatterns = [ path('', ListingsView.as_view(),name="ListALL"), path('search', SearchView.as_view()), path('<slug>', ListingView.as_view()), # Used for lising...
testusername190/Realest_Estate_Backend
backend/listings/urls.py
urls.py
py
374
python
en
code
0
github-code
36
4863814184
import numpy as np import pandas as pd import itertools from sklearn import metrics from sklearn.model_selection import GridSearchCV from sklearn.model_selection import StratifiedKFold from sklearn.model_selection import cross_val_score # models that are being considered from sklearn.ensemble import AdaBoostCla...
grikkaq/ml_hw5
elections_results.py
elections_results.py
py
7,045
python
en
code
0
github-code
36
22161452898
#!/usr/bin/env python3 import glob import os.path import re import statistics import sys from collections import defaultdict from typing import List, Dict """ USAGE: ./simple_spec_summary.py # all files in /spec/result/ ./simple_spec_summary.py 1 10 # result 1-10 from /spec/result/ ./simple_Spec_summary.py <list>...
typro-type-propagation/TyPro-CFI
scripts/simple_spec_summary.py
simple_spec_summary.py
py
3,896
python
en
code
3
github-code
36
21107255277
import sqlite3 #Her oprettes en forbindelse til databasefilen #Hvis filen ikke findes, vil sqlite oprette en ny tom database. con = sqlite3.connect('start.db') print('Database åbnet') try: con.execute("""CREATE TABLE personer ( id INTEGER PRIMARY KEY AUTOINCREMENT, navn STRING, alder INTEGER)""") ...
jonascj/learn-programming-with-python
ch-database/src/database_start.py
database_start.py
py
1,314
python
da
code
2
github-code
36
43109381353
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Apr 18 21:28:29 2021 @author: apolloseeds """ from dataset import * import matplotlib.pyplot as plt import numpy as np from scipy.io import loadmat from sklearn import model_selection from toolbox_02450 import train_neural_net, draw_neural_net, visual...
ralph-elhaddad/02450-Intro-ML
Project2/2b.py
2b.py
py
7,248
python
en
code
0
github-code
36
840464409
import random usernames_array = ["giraffe", "raccoon", "ant", "tiger", "sheep", "deer", "panda", "liger", "fox", "hippo", "alligator", "dog", "dolphin", "eagle", "zebra", "rabbit", "bear", "monkey", "leopard", "frog", "squirrel", "elephant", "bee", "duck", "kangaroo", "penguin"] ...
rifav/UbicosAppServer
textbook/app/randomGroupGenerator.py
randomGroupGenerator.py
py
2,901
python
en
code
null
github-code
36
28512647903
# Import libraries import numpy as np import pandas as pd pd.options.mode.chained_assignment = None from sqlalchemy import create_engine from googlesearch import search from tqdm import tqdm tqdm.pandas() # Read data df = pd.read_csv('data/user-item-interactions.csv') df_content = pd.read_csv('data/articles.csv') del ...
sameedakber-ai/ibm-recommendations-2
data/process_data.py
process_data.py
py
2,578
python
en
code
0
github-code
36
35056823314
import pickle import json import yaml import numpy as np import torch import torch.optim as optim import time from data_manager import DataManager from model import BiLSTMCRF from utils import f1_score, get_tags, format_result from torch.utils.tensorboard import SummaryWriter writer = SummaryWriter(log_dir='./tensorbo...
ravesky/medical_ner_pytorch
main.py
main.py
py
10,508
python
en
code
44
github-code
36
33380799983
import requests from bs4 import BeautifulSoup import time import plotly import numpy as np import pandas as pd import datetime as dt import cufflinks as cf import subprocess import traceback from sys import exit from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart import base64 import pi...
rhart-rup/Playstation-Store-Price-Drop-Alert
main.py
main.py
py
13,550
python
en
code
1
github-code
36
27895109817
def see_and_say_util(number_str): i = 0 result = [] while i < len(number_str): j = i count = 0 while j < len(number_str) and number_str[j] == number_str[i]: j += 1 count += 1 result.append(str(count)) result.append(number_str[i]) i = j ...
stgleb/algorithms-and-datastructures
strings/see_and_say.py
see_and_say.py
py
638
python
en
code
0
github-code
36
17523919887
#This tool is useful whenever you get some rough data deliverables #I used this whenever I had ~100 individually names folders, all containing a single shapefile with the same name, "Data.shp" #The goal was to rename the shapes from Data.shp, to the parent folder's name.shp import os, arcpy from subprocess import Pop...
hotlikesauce/Public-Tools
Rename Shapefile to Parent Folder.py
Rename Shapefile to Parent Folder.py
py
922
python
en
code
0
github-code
36
25714644305
import numpy as np import matplotlib.pyplot as plt def plot_with_exponential_averaging(x, y, label, alpha): y_ema = [y[0],] for y_i in y[1:]: y_ema.append(y_ema[-1] * alpha + y_i * (1 - alpha)) p = plt.plot(x, y_ema, label=label) plt.plot(x, y, color=p[0].get_color(), alpha=0.2) def...
olenmg/dopamine-rl
utils/plot.py
plot.py
py
804
python
en
code
0
github-code
36
72287095464
#!/usr/local/python3/bin/python3 import sys sys.path.append("..") import tushare as ts import re import datetime import basicdata.basic_mgr as sk import time import os import pandas as pd g_update_newest=False #True|False #是否下载最新的概念,一般不需要 g_ctcode_name=None #g_ctcode_name['TS56']='电改' g_tscode_concept=None #g_tscode...
haianhua/stock
stock/conceptdata/concept_mgr.py
concept_mgr.py
py
2,624
python
en
code
0
github-code
36
71961526185
# -*- coding: utf-8 -*- from numpy import zeros from copy import deepcopy from numpy import cast from numpy import dot from numpy import linalg class SSMOperation: def localNormalize(self, M): M = deepcopy(M) maxValue = M.max() for rowIdx in range(M.shape[0]): M[rowIdx] = map(lambda value: value / maxValu...
fukuball/lyrics-match
p-library/lyrics_form_analysis/SSMOperation.py
SSMOperation.py
py
1,578
python
en
code
19
github-code
36
35018437018
import line import cv2 import time import serial # Camera vid = cv2.VideoCapture(0) # Elegoo power_forward = 100 power_sideway_minimal = 130 power_sideway_maximal = 200 compteur = 0 ips = 0 after = time.time() + 1 imprimer_taille_image = True left_begin = 0 left_end = 85 right_begin = 95 right_end = 180 compteur_...
GuillaumeCariou/I3S_Tutorship_Internship
Python/Line_Following/Line/main_rgb.py
main_rgb.py
py
3,992
python
en
code
0
github-code
36
10660236943
# coding=utf-8 import mysql.connector from mysql.connector import Error import requests import json import datetime dias_semana = ['Domingo', 'Segunda-feira', 'Terça-feira', 'Quarta-feira', 'Quinta-feira', 'Sexta-feira', 'Sábado'] try: # recupera dataset do chat url_json = "http://raw.githubusercontent.com/ca...
camilabianchi/graces_desafio
2_importacao_python_airflow/importa_chat.py
importa_chat.py
py
2,617
python
pt
code
0
github-code
36
20405590464
import matplotlib.pyplot as plt from tespy.networks import Network from tespy.connections import Connection from tespy.components import (Source, Sink, Condenser, Pump) # Create a TESPy network nw = Network(fluids=['water', 'NH3']) # Add components and connections to the network source = Source('source') sink = Sink(...
JubranKhattab/testing_tespy_projects
subsystems/ploting.py
ploting.py
py
1,346
python
en
code
0
github-code
36
22193337403
# Задайте последовательность чисел. # Напишите программу, которая выведет список # неповторяющихся элементов исходной последовательности. list_1 = [] list_2 = [] for i in range(int(input('Введите количество чисел: '))): list_1.append(int(input(f'Введите число № {i + 1}: '))) if list_1[i] not in list_2: ...
Minions-Wave/GB-Minions-Wave
The Big Brain Solutions/Personal Zone/Zhuravlevivan Solutions/Python/HW/04/Task_03.py
Task_03.py
py
571
python
ru
code
2
github-code
36
26634573192
import requests def request_demo(): url = "https://qyapi.weixin.qq.com/cgi-bin/gettoken" param = { "corpid":"ww93348658d7c66ef4", "corpsecret":"T0TFrXmGYel167lnkzEydsjl6bcDDeXVmkUnEYugKIw" } proxy = { "http": "http://127.0.0.1:8080", "https": "http://127.0.0.1:8080" }...
ceshiren/HogwartsSDET17
test_mock/requests_demo.py
requests_demo.py
py
447
python
en
code
7
github-code
36
12243691897
from django.test import TestCase, RequestFactory from django.urls import reverse from django.contrib.auth.models import User, Permission from django.contrib import admin from django_comment import models from .test_app.models import TestModel from django_comment.admin import CommentedItemAdmin, CommentedItemInline ...
genosltd/django-comment
tests/test_admin.py
test_admin.py
py
4,334
python
en
code
0
github-code
36
72425931625
from selenium import webdriver from selenium.webdriver.chrome.service import Service from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from bs4 import BeautifulSoup import pandas as pd from selenium.webdriver.common.by import By import re from webdr...
umairahmad89/h-m-scraper
scraper.py
scraper.py
py
2,718
python
en
code
0
github-code
36
10836961705
import pandas as pd from flask import Flask, jsonify, request,json import pickle model = pickle.load(open('model.pkl','rb')) app = Flask(__name__) @app.route('/', methods=['POST']) def predict(): # get data body_dict = json.loads(request.get_data().decode('utf-8')) data = body_dict['0'] # predic...
liJiansheng/Catchup
LR Model API/app.py
app.py
py
695
python
en
code
0
github-code
36
18113301417
import pygame #зарускаем программу pygame.init() #add colors black=( 0, 0, 0) white=( 255, 255, 255) green=( 0, 255, 0) red=( 255, 0, 0) size = [700,700] screen=pygame.display.set_mode(size) pygame.display.set_caption("Professor Craven's Cool Game") done = True clock=pygame.time.Clock() screen.fill(white)...
AndreiTsukov/PythonFiles
Classwork/pygame/lesson1/snegovik.py
snegovik.py
py
532
python
en
code
0
github-code
36
496475437
from dagster_pandas import DataFrame from google.cloud.bigquery.job import LoadJobConfig, QueryJobConfig from google.cloud.bigquery.table import EncryptionConfiguration, TimePartitioning from dagster import InputDefinition, List, Nothing, OutputDefinition, Path, check, solid from .configs import ( define_bigquery...
helloworld/continuous-dagster
deploy/dagster_modules/libraries/dagster-gcp/dagster_gcp/bigquery/solids.py
solids.py
py
5,243
python
en
code
2
github-code
36
21120272187
import sys import pickle import torch as T import torch.nn as nn import torch.optim as optim import torch.nn.functional as F sys.path.append("../") # nopep8 from model.dialog_acts import Encoder from DataLoader.bucket_and_batch import bucket_and_batch import numpy as np import string import random device = T.device('...
JRC1995/Chatbot
Classifier/train_and_test/train.py
train.py
py
3,877
python
en
code
79
github-code
36
23435816279
import unittest import arcpy import os import UnitTestUtilities import Configuration class RadialLineOfSightTestCase(unittest.TestCase): ''' Test all tools and methods related to the Radial Line Of Sight tool in the Military Tools toolbox''' inputTable = None outputPoints = None def setUp(self): ...
tomwuvip/military-tools-geoprocessing-toolbox
utils/test/visibility_tests/RadialLineOfSightTestCase.py
RadialLineOfSightTestCase.py
py
3,458
python
en
code
null
github-code
36
477381730
import re class DbStructure: """ Mock class used when working with classes which read the database structure/rows This handles just a few simple queries: SHOW TABLES, SHOW CREATE TABLE, and SELECT * FROM """ def __init__(self, tables, table_rows): self.tables = tables self.table_ro...
cmancone/mygrations
mygrations/tests/mocks/db/mysql/db_structure.py
db_structure.py
py
4,255
python
en
code
10
github-code
36
36725320029
# -*- coding: utf-8 -*- from preprocess import Channel from workflow.cf_workflow import run as user_cf from workflow.if_workflow import run as user_if from workflow.rsif_workflow import run as user_rsif from workflow.lfm_workflow import run as lfm from workflow.prank_workflow import run as prank from flask import Flask...
ang0410/recommend
manage.py
manage.py
py
4,408
python
en
code
0
github-code
36
32844059000
import xlrd import product def excel_reader(file_name): # open excel sheet loc = "C:/Users/andym/PycharmProjects/FacebookScraper/" + file_name read_list = [] temp_list = [] wb = xlrd.open_workbook(loc) sheet = wb.sheet_by_index(0) sheet.cell_value(0, 0) rows_total = sheet.nrows c...
andymangibbs/CraigslistScraper
excelRead.py
excelRead.py
py
1,154
python
en
code
0
github-code
36
37228662161
from .optimizer import optimizer import numpy as np from copy import copy class DaviesSwannCampey(optimizer): def __init__(self, func, x_0 = None, initial_increment = None, scaling_constant = 0.1, interval = [-100, ...
crucis/ConvexOptimization
models/optimizers/DaviesSwannCampey.py
DaviesSwannCampey.py
py
4,457
python
en
code
3
github-code
36
40961470159
# coding: utf-8 import datetime from simpleai.search import astar, SearchProblem from simpleai.search.viewers import BaseViewer class RobotProblem(SearchProblem): def __init__(self, pallets_a_entregar): ''' En el estado necesitamos llevar la posición de los pallets, la del robot, si tenemo...
ucse-ia/ucse_ia
practicas/robot_pallets.py
robot_pallets.py
py
5,721
python
es
code
5
github-code
36
70807051303
testCase = int(input()) for i in range(1, testCase+1): money = int(input()) first = money//50000 money %= 50000 second = money//10000 money %= 10000 third = money//5000 money %= 5000 fourth = money//1000 money %= 1000 fifth = money//500 money %= 500 sixth = mon...
unho-lee/TIL
CodeTest/Python/SWEA/D2_1970.py
D2_1970.py
py
515
python
en
code
0
github-code
36
23129694122
import speech_recognition as sr from state import State from ClientThread import* import threading class VoiceRecognizer: State.event = 'create' def __init__(self): self.client = ClientThread() self.r = sr.Recognizer() self.speech = '' self.recognitionResult = '' se...
Moufdi96/Projet_IHM_Multimodal
speecheRecognizer.py
speecheRecognizer.py
py
1,682
python
en
code
0
github-code
36
22543357667
import jwt import json import logging import time from jwt import ExpiredSignatureError logger = logging.getLogger("handler_logger") logger.setLevel(logging.DEBUG) def jwt_encode(obj): try: return jwt.encode(obj, '#0wc-0-#@#14e8rbk#bke_9rg@nglfdc3&6z_r6nx!q6&3##l=', ...
gaurav3g/chat-sls-server
backend/utils/jwt_utils.py
jwt_utils.py
py
842
python
en
code
0
github-code
36
31552686748
import sys import numpy as np def transform_mat(h,V,T,N,C): from transformVMat import transformV print("\nTransforming h,v,T,N,C into converged basis...\n") return C.T * h * C, \ transformV(V,C), \ C.T * T * C, \ C.T * N * C def two_idx_mat_add_spin(Mat): dim = Mat.shape[0] return...
sskhan67/GPGPU-Programming-
QODE/Applications/Be_n/dimer_H/run_template/pyquante_scf/pyquante_to_mine.py
pyquante_to_mine.py
py
2,255
python
en
code
0
github-code
36
37349168777
from ase.units import Ha import numpy as np from my_gpaw.xc.fxc import KernelWave, XCFlags, FXCCache from my_gpaw.xc.rpa import GCut from my_gpaw.response.pair_functions import SingleQPWDescriptor from my_gpaw.pw.descriptor import PWMapping class G0W0Kernel: def __init__(self, xc, context, **kwargs): sel...
f-fathurrahman/ffr-learns-gpaw
my_gpaw/response/g0w0_kernels.py
g0w0_kernels.py
py
2,219
python
en
code
0
github-code
36
17392881824
from sorter import Sorter class QuickSort(Sorter): name = "Quick Sort" def __init__(self): super(QuickSort, self).__init__() def sort(self, L): self._log(L) return self.quick_sort(L, 0, len(L)-1) def partition(self, L, lo, hi): # choose pivot pivot = L[hi] ...
ekeilty17/Personal-Projects-In-Python
Sorting/quick_sort.py
quick_sort.py
py
1,027
python
en
code
1
github-code
36
21499220627
'Implementation of the Insertion Sort Algorithm.' print("***** Implementation of Insertion Sort Algorithm *****") def InsertionSort(theSeq): n = len(theSeq) for i in range(1, n): 'saving the value to the position.' value = theSeq[i] 'Finding the position where values fits in the orde...
amshrestha2020/ConsoleAppPython
InsertionSort.py
InsertionSort.py
py
870
python
en
code
0
github-code
36
31061296375
from ..utils import Object class GetBackgroundUrl(Object): """ Constructs a persistent HTTP URL for a background Attributes: ID (:obj:`str`): ``GetBackgroundUrl`` Args: name (:obj:`str`): Background name type (:class:`telegram.api.types.BackgroundType`): ...
iTeam-co/pytglib
pytglib/api/functions/get_background_url.py
get_background_url.py
py
801
python
en
code
20
github-code
36
26166080106
import argparse import os import cv2 import matplotlib.pyplot as plt import maxflow import networkx as nx import numpy as np class GraphCuts: def __init__(self, src, target, mask, save_graph=False): """ Initialize the graph and computes the min-cut. :param src: image to be blended ...
c1a1o1/graphcut-textures
src/graphcut_textures.py
graphcut_textures.py
py
7,197
python
en
code
0
github-code
36
534546914
import pygame as p from Chess import ChessEngine, SmartMoveFinder, DataToLearn, VisualizData import time import xml.etree.ElementTree as gfg import os.path from Chess.DataTree import TreeNode WIDTH = HEIGHT = 512 DIMENSION = 8 SQ_SIZE = HEIGHT // DIMENSION MAX_FPS = 15 IMAGES = {} WHITE_PIECE_CAPTUED = [] BLACK_PIECE...
KaiBaeuerle/chessAI
Chess/ChessMain.py
ChessMain.py
py
16,775
python
en
code
0
github-code
36
11439201598
from itertools import product from typing import Union Coor = Union[tuple[int, int, int], tuple[int, int, int, int]] CubeMap = set[Coor] def get_input() -> CubeMap: with open('input.txt', 'r') as f: return {(i, j, 0) for i, l in enumerate(f.readlines()) for j, ch in enumerate(l) if l and ch == '#'} def n...
markopuzav/aoc-2020
day17/solution.py
solution.py
py
1,413
python
en
code
0
github-code
36
16209591268
# -*- coding: utf-8 -*- #@author: Lalo Valle import math from Programa import * programa = Programa.programa() """ Lista de nombre de los tokens """ tokens = [ 'NUMERO', 'INDEFINIDA', 'VARIABLE', 'FUNCION', 'CONSTANTE', 'CADENA', 'PRINT', 'INCREMENTO', 'DECREMENTO', 'OR', # Operadores lógicos 'AND', 'M...
LaloValle/HOC5
Recursos.py
Recursos.py
py
2,900
python
es
code
0
github-code
36
30677471039
#!/usr/bin/env python import os import sys import glob from mars_utils import * SCRIPT_PATH = os.path.split(os.path.realpath(__file__))[0] BUILD_OUT_PATH = 'cmake_build/watchos' INSTALL_PATH = BUILD_OUT_PATH + '/Darwin.out' WATCH_BUILD_SIMULATOR_CMD = 'cmake ../.. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=...
Tencent/mars
mars/build_watch.py
build_watch.py
py
3,361
python
en
code
16,975
github-code
36
4619575632
#!/usr/bin/env python import django from net_system.models import NetworkDevice, Credentials from pprint import pprint rtrs = { "test-sw1": { "port": "22", "username": "admin1", "eapi_port": "443", "password": "99saturday", "ip": "1.1.1.1", "device_type": "arista_eos" }, "test-sw2":...
jerry-bonner/pynet
class8/ex3.py
ex3.py
py
1,335
python
en
code
0
github-code
36
11917002254
from django.db import models from django.db import models from django.utils import timezone from django.contrib.auth.models import User import uuid from users.models import Profile from ckeditor.fields import RichTextField # Create your models here. def user_directory_path(instance,filename): return 'blogs/{0}/{1...
minarefaat1002/blog_website
blogs project/blog/models.py
models.py
py
2,654
python
en
code
0
github-code
36
14172483861
from pprint import pprint as pp from os import SEEK_SET lst_0 = [ 'Андрей Говорухи\t\t 6 6 1 4 9 9 10 4 8 2 3 8\n', 'Василий Петров\t\t 2 9 4 7 6 6 3 6 5 5 2 4\n', 'Гавриил Варфаломеев\t 10 10 4 10 7 9 4 6 8 1 1 1\n', 'Игнат Тюльпанов\t\t 8 1 4 1 1 5 2 5 2 2 10 8\n', 'Илья Муромцев\t\t 1 6 4 7 10 9 5 3 7 4 7 2\n',...
Bidlevskyi/hometasks_python
htask14.py
htask14.py
py
1,360
python
ru
code
0
github-code
36
17230717962
import numpy as np def load_data(path): f = open(path) x = [] y = [] for line in f.readlines(): data = line.strip().split('\t') feature = data[0].split(' ') feature.insert(0, '1') x.append(feature) y.append(data[-1]) x = np.array(x, dtype=np.flo...
VJaGG/machine-learning
foundations/code/utils.py
utils.py
py
638
python
en
code
0
github-code
36
12785925952
from py_reconhecimento import TReconhecimento from py_cadastro import TCadastro from py_principal import TPrincipal from kivy.uix.screenmanager import ScreenManager from kivy.app import App from kivy import Config from kivy.lang import Builder Config.set('graphics', 'resizable', True) Config.set('kivy', 'exit_on_escap...
eticialima/recognitionfacial
project/py_main.py
py_main.py
py
1,088
python
en
code
3
github-code
36
15715933133
import json import os import sys from tempfile import NamedTemporaryFile DEPRECATED_KEYS = [ 'site_yaml_path', 'inventory_config', 'variable_manager_config', 'passwords', 'modules', 'private_key_file'] LIST_TYPES = ['skip-tags', 'tags'] DIRECT_PARAMS = ['start_at_task', 'scp_extra_args', 'sftp...
christaotaoz/shkd-work
work/doc/srv6+5G/ansible8.82/cloudify_ansible_sdk/__init__.py
__init__.py
py
3,848
python
en
code
0
github-code
36
74504081705
import turtle import os #window = wn wn = turtle.Screen() wn.title("Developed by: Map The Coder") wn.bgcolor("purple") wn.setup(width=800, height=600) wn.tracer(0) #a tracer stops the window from updating, therfore has to be manually updated. This allows me to speed up the game on command # Score score_a = 0 score_b ...
jeremyamartins/pong.python
pong.py
pong.py
py
3,166
python
en
code
0
github-code
36
20857149837
import pandas as pd from pandas.testing import assert_frame_equal from sportpools.model.tennis import TennisPool from sportpools.model.emulator import TennisPoolEmulator ROUNDS = ["r64", "r32", "r16", "qf", "sm", "f", "w"] def test_determine_black_points(): seeds = pd.DataFrame({ 'seed': [1, 4, 6, 32, 6...
bartcode/sportpools-tennis
tests/test_tennis_pool.py
test_tennis_pool.py
py
2,212
python
en
code
0
github-code
36
29212263006
import numpy as np import pandas as pd import datetime, time # 处理输入时间戳,当前汽车驶入时间戳转化为sumo中以秒为单位 def time_processing(timeStamp): timeArray = time.localtime(timeStamp) # 时间时区设置转换 base_time = datetime.datetime(timeArray[0], timeArray[1], timeArray[2], 0, 0, 0) # 获取当日日期定位到00:00:00 base_time = time.mktim...
Rossions/TCSC
DataProcessing/chengdu/processing_abandon.py
processing_abandon.py
py
2,020
python
en
code
1
github-code
36
25615151962
#!/usr/bin/env python # -*- coding:utf-8 -*- import os import pandas as pd from datetime import datetime from txt_table import txt_table import re # 将txt文件转化为csv def transfer_data(folder): #建立使用文件列表 filenames=[] filelist=[] filexlsx=[] #遍历文件寻找txt files=os.walk(folder) ...
hellboy1990/qixiang_explore
qixiang_check_v2.py
qixiang_check_v2.py
py
7,538
python
en
code
5
github-code
36
72603582824
a = int(input()) b = int(input()) c = [] d = 0 f = [] for i in range(a + b): c.append(input()) for i in c: if i not in f: f.append(i) d += 1 else: d -= 1 if d != 0: print(d) else: print('Таких нет')
Reagent992/yandex_academy
3.2 Множества, словари/05.py
05.py
py
256
python
en
code
0
github-code
36
73224987304
# views.py from django.shortcuts import get_object_or_404 from rest_framework import status from rest_framework.decorators import api_view from rest_framework.response import Response from calculator.models import Report from calculator.serializers import ReportSerializer, ReportCalculationSerializer import pandas as p...
StefKal/superdupertax
superdupertax/calculator/views.py
views.py
py
2,749
python
en
code
0
github-code
36
73692412265
import copy import mock import testtools from stackalytics.processor import default_data_processor from stackalytics.processor import normalizer from stackalytics.tests.unit import test_data class TestDefaultDataProcessor(testtools.TestCase): def setUp(self): super(TestDefaultDataProcessor, self).setUp(...
Mirantis/stackalytics
stackalytics/tests/unit/test_default_data_processor.py
test_default_data_processor.py
py
7,360
python
en
code
12
github-code
36
8413029677
import sqlite3 connection = sqlite3.connect('data.db') cursor = connection.cursor() create_table = "CREATE TABLE IF NOT EXISTS hotels (hotel_id text PRIMARY KEY, name text, stars real, price real, city text)" cursor.execute(create_table) connection.commit() connection.close()
mariorodeghiero/flask-python-rest-api-course
create_db.py
create_db.py
py
279
python
en
code
0
github-code
36
74791240424
import math import json import random import argparse def genRandomFeatures(n): features = [] for i in range(0, n): lat = (random.random() - 0.5) * 360.0 lng = (random.random() - 0.5) * 180.0 geom = { 'type': 'Point', 'coordinates': [lat, lng] } props = { 'class': 1 if random.random() > 0.5 else 0 ...
decision-labs/mapnik
benchmark/utils/random_points.py
random_points.py
py
1,569
python
en
code
0
github-code
36
7136369222
# -*- coding: utf-8 -*- # *************************************************** # * File : timefeatures.py # * Author : Zhefeng Wang # * Email : wangzhefengr@163.com # * Date : 2023-04-19 # * Version : 0.1.041901 # * Description : description # * Link : link # * Requirement : 相关模块版本需求...
wangzhefeng/tsproj
utils/timefeatures.py
timefeatures.py
py
17,505
python
en
code
0
github-code
36
24417230499
from os.path import exists from pyimpspec.data.data_set import ( DataSet, dataframe_to_data_sets, ) from typing import List def parse_spreadsheet(path: str, **kwargs) -> List[DataSet]: """ Parse a spreadsheet (.xlsx or .ods) containing one or more impedance spectra. Parameters ---------- ...
vyrjana/pyimpspec
src/pyimpspec/data/formats/spreadsheet.py
spreadsheet.py
py
1,039
python
en
code
12
github-code
36
75072637544
from vedo import Mesh, show, Lines mesh_a = Mesh("../data/mouse_limb_a.stl").c("red5") mesh_b = Mesh("../data/mouse_limb_b.stl").c("green5") # Here user clicks on mesh A and then B to pick 5+5 landmarks show("Click meshes & press i", mesh_a, mesh_b).clear() # This shows that automatic alignment may be not good enoug...
BiAPoL/PoL-BioImage-Analysis-TS-Early-Career-Track
docs/day2a_image_segmentation/vedo_material/scripts/10-morph_ab.py
10-morph_ab.py
py
1,376
python
en
code
6
github-code
36
34594770015
"""OpenAPI schema utility functions.""" from io import StringIO _DEFAULT_EXAMPLES = { "string": "string", "integer": 1, "number": 1.0, "boolean": True, "array": [], } _DEFAULT_STRING_EXAMPLES = { "date": "2020-01-01", "date-time": "2020-01-01T01:01:01Z", "password": "********", ...
sphinx-contrib/openapi
sphinxcontrib/openapi/schema_utils.py
schema_utils.py
py
4,446
python
en
code
103
github-code
36
43298189764
from rpython.rtyper.lltypesystem import rffi, lltype from pypy.module.cpyext.api import ( cpython_api, cpython_struct, bootstrap_function, build_type_checkers, CANNOT_FAIL, Py_ssize_t, Py_ssize_tP, PyObjectFields, slot_function) from pypy.module.cpyext.pyobject import ( decref, PyObject, make_ref, make_type...
mozillazg/pypy
pypy/module/cpyext/sliceobject.py
sliceobject.py
py
4,493
python
en
code
430
github-code
36
8983073054
from datetime import datetime from typing import Optional, Union class Poll: """ Slot class for each Pool object. """ MAX_OPTIONS = 10 MIN_OPTIONS = 2 __slots__ = [ "_message_id", "_channel_id", "_question", "_options", "_date_created_at", "_us...
TheXer/Jachym
src/ui/poll.py
poll.py
py
1,559
python
en
code
11
github-code
36
40618220774
from django.conf.urls import url from . import views urlpatterns=[ url(r'^register/',views.mapiview.as_view()), url(r'^editview/',views.mapiview1.as_view()), url(r'^update/',views.mapiview2.as_view()), url(r'^vcus/',views.vcustomer), url(r'^registercus/',views.post), url(r'^viewtr/(?P<idd>\w+)',...
jannamariyam/GOLD_APP
SPRINT 4/web/goldinapp/customer/urls.py
urls.py
py
366
python
en
code
0
github-code
36
15131148748
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def reverseList(self, head): """ :type head: ListNode :rtype: ListNode """ # 아무것도 주어지지 않은 경우 if head is None: ...
EnteLee/practice_algorithm
leetcode/206_reverse_linked_list/reverse_linked_list_yyj.py
reverse_linked_list_yyj.py
py
568
python
en
code
0
github-code
36
72173860264
import math def sieve_of_sundaram(n): k = (n - 2) // 2 # sınır belirliyor prime_list = [] integers_list = [True] * (k + 1) # sınır kadar dizi oluşturuyor for i in range(1, k + 1): # sınır kadar eleman dönüyor. j = i while i + j + 2 * i * j <= k: # 4 < 50 7 15 integers_...
bugramuazmujde/ProjectEuler
problem_50_consecutive_prime_sum.py
problem_50_consecutive_prime_sum.py
py
1,143
python
en
code
0
github-code
36
33006855107
import csv import io from nltk.tokenize import word_tokenize import sys reload(sys) sys.setdefaultencoding('ISO-8859-1') def findLowest(topWords): result = topWords.keys()[0] for word in topWords: if(topWords[word] < topWords[result]): result = word return result with io.open("old_tweets.csv", encoding = "IS...
Temirlan97/WhatTwitterFeels
wordBag/countWords.py
countWords.py
py
1,230
python
en
code
0
github-code
36
40974261041
#Import libraries import numpy as np import sqlalchemy from sqlalchemy.ext.automap import automap_base from sqlalchemy.orm import Session from sqlalchemy import create_engine, func from flask import Flask, jsonify #Database Connection engine = create_engine("sqlite:///Resources/hawaii.sqlite") #Map database Base = au...
AJ-Paine/10-Hawaii-Temperature-Exploration
app.py
app.py
py
3,710
python
en
code
0
github-code
36
323607876
"""added Client Favourite and product views Revision ID: bcc08ae9bed7 Revises: 399549c08a2a Create Date: 2020-01-24 22:55:04.098191 """ from alembic import op import sqlalchemy as sa import sqlalchemy_utils # revision identifiers, used by Alembic. revision = 'bcc08ae9bed7' down_revision = '399549c08a2a' branch_labe...
Dsthdragon/kizito_bookstore
migrations/versions/bcc08ae9bed7_added_client_favourite_and_product_views.py
bcc08ae9bed7_added_client_favourite_and_product_views.py
py
1,741
python
en
code
0
github-code
36
20885862962
# flake8: noqa import nltk nltk.download("brown") nltk.download("names") import numpy as np import multiprocessing as mp import string import spacy import os os.system("python -m spacy download en_core_web_sm") from sklearn.base import TransformerMixin, BaseEstimator from normalise import normalise import pandas as ...
Lolik-Bolik/Hashing_Algorithms
utils/process_book.py
process_book.py
py
2,868
python
en
code
2
github-code
36
7147825929
#!/usr/bin/env python3 import re import sys import linecache from pathlib import Path regex = re.compile('#?(.*)\s?=\s?(.*)') data = '' try: fpath = str(sys.argv[1]) if not Path(fpath).is_file(): raise Exception("file path is invalid or not a file") except: print("Error: file not provided or inval...
japtain-cack/docker-marid
files/configToRemco.py
configToRemco.py
py
1,338
python
en
code
0
github-code
36