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
73115999522
import numpy as np import matplotlib.pyplot as plt import magpylib as magpy import lmfit from lmfit import Minimizer, Parameters, report_fit M = 6335/(4*1.26) # magnetization (mT) D = .5*25.4 # diameter (mm) L = .75*25.4 # length (mm) def Cylmag(loc,ori,d=D,l=L,m=M): return magpy.source.magnet.Cylinder(mag=[...
hemmerlinglab/Zeeman_Calc
opt_zeeman.py
opt_zeeman.py
py
3,364
python
en
code
0
github-code
54
13028330377
#!/usr/bin/python # # menu.py # lcd menu module for poolPi # displays the contextual menus on the lcd # and uses the button module to read responses # # NOTE: Cursor home position is 1,1 not 0,0 # # version 1.51 04-07-20: fixed manual and # and dev modes # import time import config as c import globalVars as gv imp...
tbitson/PoolPi
src/menu.py
menu.py
py
13,785
python
en
code
0
github-code
54
46292082207
#------------------------ Download data of file(.csv) from internet from urllib import request goog_url='https://www.stats.govt.nz/assets/Uploads/Annual-balance-sheets/Annual-balance-sheets-2016-provisional/Download-data/annual-balance-sheet-2007-16-provisional-csv-tables.csv' def download_file(csv_url): re...
zeeshantalib/Python
Python Web Crawler/zeeshantalib77_01_download_file_data_from_web.py
zeeshantalib77_01_download_file_data_from_web.py
py
597
python
en
code
1
github-code
54
16382983714
#!/usr/bin/env python from numpy import * import tf # Basic ROS imports import roslib import rospy import PyKDL import sys import rosbag # import msgs from std_msgs.msg import Float64MultiArray from geometry_msgs.msg import Pose from geometry_msgs.msg import Quaternion from geometry_msgs.msg import WrenchStamped from...
alsaibie/uwsim_underwater_simulation
underwater_vehicle_dynamics/src/dynamics_dolphin.py
dynamics_dolphin.py
py
21,551
python
en
code
0
github-code
54
32557469582
import re import random import uuid import json import os from sts.sts import Sts from rest_framework.views import APIView from rest_framework.response import Response from rest_framework import serializers from rest_framework.exceptions import ValidationError from django_redis import get_redis_connection from tencent...
975646741112/actionswchat
api/views.py
views.py
py
7,751
python
zh
code
0
github-code
54
36434149564
""" Example of linear and non-linear models ======================================== This is an example plot from the tutorial which accompanies an explanation of the support vector machine GUI. """ import numpy as np import matplotlib.pyplot as plt from sklearn import svm rng = np.random.default_rng(27446968) ##...
scipy-lectures/scipy-lecture-notes
packages/scikit-learn/examples/plot_svm_non_linear.py
plot_svm_non_linear.py
py
2,744
python
en
code
3,000
github-code
54
6095164794
import os import gym import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.distributions import Normal import numpy as np import random from collections import deque class QNetwork(nn.Module): def __init__(self, state_dim, action_dim, q_lr): super(QNetw...
JM-Kim-94/rl-pendulum
Pendulum_SAC/pendulum_sac_test.py
pendulum_sac_test.py
py
3,716
python
en
code
8
github-code
54
73412395360
def three_odd_numbers(nums): """Is the sum of any 3 sequential numbers odd?" >>> three_odd_numbers([1, 2, 3, 4, 5]) True >>> three_odd_numbers([0, -2, 4, 1, 9, 12, 4, 1, 0]) True >>> three_odd_numbers([5, 2, 1]) False >>> three_odd_numbers([1, 2, 3, 3, 2])...
bcdipesh/python-ds-practice
fs_3_three_odd_numbers/three_odd_numbers.py
three_odd_numbers.py
py
1,010
python
en
code
0
github-code
54
5528430275
import cv2 import numpy as np import matplotlib.pyplot as plt from PIL import ImageGrab as Ig import pyautogui as pg import mouse import time def get_clicked_position() : while True : if mouse.is_pressed("left") : return mouse.get_position() def get_colors_arr(screen, position) : return_a...
moonsung1234/Dot_image
main.py
main.py
py
2,064
python
en
code
2
github-code
54
25736952929
#module to contain all settings of space smash class Settings(): """a class to contain all settings of space smash.""" def __init__(self): """initialize the game's static settings.""" #screen settings self.screen_width = 1400 self.screen_height = 800 self.bg_color ...
chiragtyagi2003/Smash-It
settings.py
settings.py
py
1,813
python
en
code
0
github-code
54
15673167974
players_registered = { } cardgameInfo = { } gamePlayerInfo = { } roundInfo = { } #value como valor de la carta (del dibujito) y relValue como valor en el juego esp = { "O01": { "literal" : "As de Oros" , "value" : 1, "priority" : 1, "realValue" : 1}, "O02": { "literal" : "Dos de Oros" , "value"...
VDani3/siete_y_medio
juegoSieteYMedio/dictionary.py
dictionary.py
py
7,675
python
en
code
0
github-code
54
10114266898
"""empty message Revision ID: 951b8ed9a8e1 Revises: 9ab3158991e2 Create Date: 2020-05-12 09:53:12.043249 """ from alembic import op import sqlalchemy as sa import sarna # revision identifiers, used by Alembic. revision = '951b8ed9a8e1' down_revision = '9ab3158991e2' branch_labels = None depends_on = None def upgr...
rsrdesarrollo/sarna
migrations/versions/951b8ed9a8e1_.py
951b8ed9a8e1_.py
py
1,127
python
en
code
38
github-code
54
26293548902
def dec2arb(num,base): arbitrary = '' quotient = num while quotient > 0: remainder = quotient % base arbitrary += str(quotient % base) quotient = (quotient // base) arbitrary = arbitrary[::-1] return arbitrary def arb2dec(num_str,base): decimal = 0 for i in num_str: ...
XavierPlayzTheDueldox/Python_Lvl2
.vscode/Functions/ex99.py
ex99.py
py
552
python
en
code
0
github-code
54
23180228980
import ttkbootstrap as tkb import tkinter as tk from ttkbootstrap import constants window = tkb.Window(themename='vapor') window.geometry('600x600') window.resizable(False, False) def clicker(): language_label.config(text=f"{my_combo.get()}") def click_bind(e): language_label.config(text=f"{my_combo.get()}")...
kiordev/PYTHON-TTKBOOTSTRAP
Lessons/ComboBox.py
ComboBox.py
py
852
python
en
code
1
github-code
54
568137533
''' 条件概率公式:P(A|B) = P(A∩B)/P(B) = [P(B|A)*P(A)]/P(B) 全概率公式: P(B) = P(B|A)*P(A)+P(B|A')*P(A') P(A|B) = P(B|A)*P(A)/[P(B|A)*P(A)+P(B|A')*P(A')] 贝叶斯推断: P(A|B) = P(A)*[P(B|A)/P(B)] 朴素贝叶斯:对条件个概率分布做了条件独立性的假设 后验概率 = 先验概率 x 调整因子 P(A|Xn) = P(A)*[P(Xn|A)/P(Xn)] = P(A)*[P(X1*X2*..*Xn|A)/P(X1*X2*..*Xn)] = P(A)*[P(X1|A)*P(...
okurumio/ML
Algorithm/Naive-Bayesian.py
Naive-Bayesian.py
py
3,985
python
en
code
0
github-code
54
34469884667
import serial from time import time ser = serial.Serial(port='COM3', baudrate=74880) # 115200 , 38400 while True: start = time() # Read data out of the buffer until a carraige return / new line is found # ser.reset_input_buffer() serialString = ser.readline() # serialString = ser.readline() ...
MarcosLen/PFin
serial_read.py
serial_read.py
py
466
python
en
code
0
github-code
54
9024580171
"""Module to provide access to and control over push buttons. """ __author__ = "Oliver Maye" __version__ = "0.1" __all__ = ["Button"] import logging from pymitter import EventEmitter from .gpio import GPIO from .module import Module from .systypes import ErrorCode class Button( Module, EventEmitter ): """Gene...
olimaye/philander
philander/button.py
button.py
py
4,303
python
en
code
0
github-code
54
5526611835
""" Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in logarithmic time complexity. solution: in fact number of 5 as factor """ def trailing_zeroes(n): """ :type n: int :rtype: int """ count = 0 while n: count += n / 5 n = n / 5 ...
moontree/leetcode
version1/172_Factorial_Trailing_Zeros.py
172_Factorial_Trailing_Zeros.py
py
336
python
en
code
1
github-code
54
37778579350
import numpy as np from sverchok.utils.testing import * from sverchok.utils.geom import LinearSpline class LinearSplineTests(SverchokTestCase): def setUp(self): super().setUp() vertices = [(-1, -1, 0), (0, 0, 0), (1, 2, 0), (2, 3, 0)] self.control_points = np.array(vertices) self...
nortikin/sverchok
tests/linear_spline_tests.py
linear_spline_tests.py
py
1,657
python
en
code
2,098
github-code
54
24610485845
import paho.mqtt.client as mqtt import os # This is the Subscriber def on_connect(client, userdata, flags, rc): print("Connected with result code " + str(rc)) client.subscribe("3d_printer_camera_rpi_3") def on_message(client, userdata, msg): if msg.payload.decode("utf-8") == "take_photo": os.syst...
Pawel2357/IoT_home
3d_printer_hub/flask_web/3d_printer_camera.py
3d_printer_camera.py
py
652
python
en
code
0
github-code
54
41180678769
import base64 import json import os import tempfile from fastapi import FastAPI, HTTPException, status from helpers import email_helper, meeting_helper, storage_helper from models import Calendar, Email, Event, Folder, Item, NewCalendar,\ NewEvent, NewItem, SharedFolder from consts.auth import Auth from utils.lo...
Minfante377/assistant-google-api
api.py
api.py
py
10,189
python
en
code
0
github-code
54
30004834302
import json import re FIR_ids_for_this_vacc = ["LPPO"] # A file containing only SECTOR data, limited noise (white lines, comments) is allowed. with open('Input/File With Sectors for AIRSPACE.txt',"r",encoding='utf-8') as f: # File like: # SECTOR:EBBU·EBBE TMA1A·025·035:02500:03500 # OWNER:MIL:...
MatisseBE/vatglasses-converter
Create AIRSPACE from ESE.py
Create AIRSPACE from ESE.py
py
8,113
python
en
code
2
github-code
54
35024576117
#!/usr/bin/env python3 # staticmethod import os class Executor: def __init__(self, command): self.command = command @staticmethod def chdir(path): os.chdir(path) def __call__(self): return ( os.popen(self.command) .read().strip() ) orig_path = os...
pimiento/decorators_and_oop_webinar
16_staticmethod.py
16_staticmethod.py
py
505
python
en
code
0
github-code
54
32972259440
import pickle import os, os.path class Pickler: def __init__(self): self.review_list = [] self.num_reviews = 0 def add_review(self, review): self.review_list.append(review) self.num_reviews += 1 def pickle_reviews(self): reviewers = [] for i in range(1, s...
ts549/Product_Reviewer
util/Pickler.py
Pickler.py
py
1,029
python
en
code
0
github-code
54
4873269956
import psycopg2 import time from fastapi import FastAPI, Response, status, HTTPException, Depends from fastapi.params import Body from pydantic import BaseModel from typing import Optional from random import randrange from psycopg2.extras import RealDictCursor from sqlalchemy.orm import Session from . import models f...
rsolovyeaws/fastapi
app/main.py
main.py
py
3,588
python
en
code
0
github-code
54
36963436592
from openpyxl import load_workbook import os class CreateDataset: def __init__(self): cd = os.getcwd() self.path1 = cd + '/Indian_first_names.xlsx' self.path2 = cd + '/Indian_middle_names.xlsx' self.path3 = cd + '/Indian_last_names.xlsx' def generate_data_list(self, name_leng...
Sapi98/Oracle_DataBase_Creator
dataset_utils.py
dataset_utils.py
py
1,100
python
en
code
0
github-code
54
8458313718
#!/usr/bin/env python import csv import collections from typing import Counter, DefaultDict import fileinput class NaiveBayesClassifier: def __init__(self) -> None: self.data = [] self.predict_data = [] self.class_probability = DefaultDict(float) self.feature_proability = DefaultD...
desoumyadeep/data_mining
Week_13_Naive_Bayes_Classifier/HR.py
HR.py
py
2,792
python
en
code
1
github-code
54
34359446647
#203. Remove Linked List Elements def removeElements(self, head, val): while head and head.val == val: head = head.next curr = head while curr and curr.next: if curr.next.val == val: curr.next = curr.next.next else: curr = curr.next return head #(time On) ...
VinceLing0529/Leetcode-45-days
July_7.py
July_7.py
py
956
python
en
code
0
github-code
54
70059224483
# In this program, create a list of numbers from 1 to 50 named list_1. The numbers should be present in the # increasing order: Ex list_1 = [1,2,3,4,5,....,50] i.e. index zero should be 1, index one should be 2, # index two should be 3 and so on. # Given an input let's say a, you have to print the number of elemen...
VaibhavSachaa/The_Joy_of_Computing_using_Python-NPTEL
Week3/Divisibility.py
Divisibility.py
py
736
python
en
code
0
github-code
54
15967368016
import numpy as np import itertools from scipy import integrate from utils import Ps norm = np.linalg.norm class error_X2n_X: def __init__(self, eta, atoms_and_rep_uc, direct_basis_vectors, N, PP_loc_params = None, PP_NL_params = None , **kwargs): self.N = N self.n_p = int(np.ceil(np.log2(...
XanaduAI/pseudopotentials
PP/error_X2n_X.py
error_X2n_X.py
py
9,420
python
en
code
1
github-code
54
70319610721
import sys import logging def whoami(): return sys._getframe(1).f_code.co_name # this uses argument 1, because the call to whoami is now frame 0. # and similarly: def callersname(): return sys._getframe(2).f_code.co_name def log_label(obj=None, function_name=True): parts = [] if obj: parts ...
cfobel/python__logging_helpers
logging_helpers/__init__.py
__init__.py
py
1,462
python
en
code
0
github-code
54
8439015596
import os import threading import pkg_resources import pygame from pypipboy.game.core import Entity from pypipboy.pypboy.data import Maps class Map(Entity): _mapper = None _transposed = None _size = 0 _fetching = None _map_surface = None _loading_size = 0 _render_rect = None _map_ico...
manfred-kaiser/pypipboy3000
pypipboy/modules/map/entities.py
entities.py
py
2,883
python
en
code
0
github-code
54
18903637518
# Import Modules from math import * from tkinter import * import tkinter.messagebox as mbx # Add something to the entry box def do(something): current = box.get() box.delete(0, END) box.insert(0, (current + something)) # Add to the expression when a number is pressed def press(number): gl...
ss3387/simple-calculator
Calculator.py
Calculator.py
py
8,047
python
en
code
0
github-code
54
26279770723
#0078-Subsets #Given an integer array nums, return all possible subsets (the power set). #The solution set must not contain duplicate subsets. #Input: nums = [1,2,3] #Output: [[],[1],[2],[1,2],[3],[1,3],[2,3],[1,2,3]] class Solution: def subsets(self, nums: List[int]) -> List[List[int]]: res = [] ...
zhiqinlei/ProblemSolved
0078-Subsets.py
0078-Subsets.py
py
651
python
en
code
0
github-code
54
2315566912
from copy import copy def binToDec(arr): ans = 0 for i,x in enumerate(arr[::-1]): if x: ans += pow(2,i) return ans # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # se...
iamabhishek98/leetcode_solutions
sum-of-root-to-leaf-binary-numbers/sum-of-root-to-leaf-binary-numbers.py
sum-of-root-to-leaf-binary-numbers.py
py
998
python
en
code
0
github-code
54
46435819667
from __future__ import absolute_import import click from . import aws_piper @click.group() def piper(): pass @click.command() @click.option( '--config-file', default='config.yaml', help='Data pipeline job configuration file. Must be in the path of the current directory.' ) def deploy(config_file): ...
heetch/aws-piper
aws_piper/cli.py
cli.py
py
1,730
python
en
code
1
github-code
54
29310249528
import requests import pandas as pd url = 'https://www.naehrwertrechner.de/naehrwerte/C133000/Hafer+Flocken' html = requests.get(url).content df_list = pd.read_html(html) #for table_index in range(10): #there are 10 tables on the website # table = df_list[table_index].to_numpy table_index = 9 df = df_list[table...
NoHoltz/food
Importer/Importer.py
Importer.py
py
372
python
en
code
0
github-code
54
18814525756
''' The working python script ''' #Importing the Authenticator and Downloader class from PSMSP.Authenticator import Authenticator from PSMSP.Downloader import Downloader from PSMSP.Parser import Parser from PSMSP.Cryptographer import Cryptographer from PSMSP.Ziper import Ziper import configparser import os #Checking ...
reyho/PSMS
client script/session.py
session.py
py
1,754
python
en
code
0
github-code
54
3955216056
import pygame class PlayAgain: def __init__(self, display): self.display = display self.font = pygame.font.Font('freesansbold.ttf', 42) def draw(self): current_render = self.font.render(f'Press "P" to start', True, 'white') current_render2 = self.font.render(f'"Space" to jump',...
ak-19/flappybird
play_again.py
play_again.py
py
442
python
en
code
0
github-code
54
11383236671
from multiprocessing.dummy import active_children import random import numpy as np import matplotlib.pyplot as plt from math import floor import pandas as pd import seaborn as sns from typing import Dict, Tuple from FlappyAgents.abst_flappy_agent import FlappyAgent class QlearningAgent(FlappyAgent): def __init__(...
HR-Machine-Learning/RL_FlappyBird
src/FlappyAgents/qlearning_flappy_agent.py
qlearning_flappy_agent.py
py
5,438
python
en
code
null
github-code
54
7112286008
""" Train Side Loss UNet Example ================================ In this example a UNet with side supervision and auxiliary loss implemented """ ############################################################################## # Imports needed for this example import torch import torch.nn as nn from inferno.io.box.bi...
inferno-pytorch/inferno
examples/plot_train_side_loss_unet.py
plot_train_side_loss_unet.py
py
7,112
python
en
code
245
github-code
54
6949191374
import time dates = []; mj= [31,29,31,30,31,30,31,31,30,31,30,31]; def palin(y): day = (y % 10) * 10 + (y % 100) / 10; month = y / 1000 + ((y / 100) % 10) * 10; return (month != 0 and month <= 12 and day <= mj[month - 1] and day != 0); def ispis(y): ret = ""; ret += str(y % 10) ret += str((y / 10) % 10) ret +...
mkisic/HONI-19-20
6/datum/datum.py
datum.py
py
1,691
python
en
code
6
github-code
54
23993991704
from day_of_week import date_for_crawler, monthly_loop from crawler import csgo_crawler import csv from datetime import datetime def main(): columns = ['Date', 'Team', 'Standing', 'Player 1', 'Country 1', 'Player 2', 'Country 2', 'Player 3', 'Country 3', 'Player 4', ...
arthurbaldner/csgo_rankings
main.py
main.py
py
1,123
python
en
code
0
github-code
54
70983843683
import argparse import math import os import time import cv2 import numpy as np import torch import tqdm from logzero import logger def mosaic(img: np.ndarray, alpha: float = 0.05): try: w = img.shape[1] h = img.shape[0] # int()で丸めると0になった場合にエラーとなるためceil()を使用 _w ...
comapi5/dog-face-mosaic-ai
main.py
main.py
py
3,586
python
en
code
0
github-code
54
42113880060
# -*- coding: utf-8 -*- import hashlib import json import re import time import uuid import scrapy from scrapy import Selector from mysqltest import execute from ..items import AdforumItem class AdforumspiderSpider(scrapy.Spider): name = 'adforumspider' allowed_domains = ['cn.adforum.com'] # start_urls ...
kukukujinxj/python
scrapy/adforum/adforum/spiders/adforumspider.py
adforumspider.py
py
25,990
python
en
code
0
github-code
54
24497239534
# -*- coding: utf-8 -*- """ Created on Mon Jul 26 17:09:16 2021 Provides the methods to perform different kinds of text preprocessing: - Remove noise: - remove_digits: remove digits; - replace_syb: replace a substring with another substring; - clean_text: cleans text from special chara...
claudialorusso/PugliaSostenibileGUI
Preprocessing.py
Preprocessing.py
py
15,302
python
en
code
0
github-code
54
33157000570
# https://leetcode.com/explore/challenge/card/march-leetcoding-challenge-2021/591/week-4-march-22nd-march-28th/3684/ from typing import List from collections import deque class Solution: def pacificAtlantic(self, matrix: List[List[int]]) -> List[List[int]]: if not matrix: return M, N = len(matrix...
jyeoniii/algorithm
20210326/pacific_atlantic_water_flow.py
pacific_atlantic_water_flow.py
py
1,118
python
en
code
0
github-code
54
15670219859
import bingo as bg import numpy as np def main(): with open("input.txt", "r") as file: inputs = file.readlines() inputs = [input.replace("\n", "") for input in inputs] drawn_numbers, boards = bg.parse_inputs(inputs) # part 1 winning_board = None winning_round = np.Inf # part 2 ...
Nicky027/advent-of-code
advent_of_code_2021/day_04/main.py
main.py
py
997
python
en
code
0
github-code
54
45022386069
import os import sys import logging import datetime import pytest import numpy as np import spc_spectra as spc from hypothesis import settings, given, strategies as st sys.path.append(os.path.join(os.getcwd(),"src")) # Adds higher directory to python modules path. from SPyC_Writer.SPCFileWriter import SPCFileWriter ...
WasatchPhotonics/SPyC_Writer
tests/test_writer.py
test_writer.py
py
6,830
python
en
code
1
github-code
54
12308973395
import requests import json from datetime import datetime import plotly.graph_objects as go from plotly.subplots import make_subplots import pandas as pd import time import plotly.express as px lido_data = pd.read_csv('data/lido_deposits.csv') #fig = px.bar(eip_data, x="number", y="Burned ETH per Block") fig = g...
aphrodite999/eth_analytics_main
defi_historical/misc/lido.py
lido.py
py
2,417
python
en
code
0
github-code
54
17341976784
class Adder: def behaviour(self,w,s,n,e): W = (e^w)^s N = ((e^w)&n)|(e&w) S = 0 E = 0 return [W,S,N,E] class Program: #North = up, south = down, east = right, west = left def __init__(self): self.array =[ [Adder()], [Adder()], [Adder()], [Adder()] ]
Al153/Programming
Python/Misc/Example FPGA Program.py
Example FPGA Program.py
py
277
python
en
code
1
github-code
54
11037679270
global tgt_id, gps_file, target_file, gps_output # PARAMETERS TO EDIT BY USER ########################################################## # Target set to display distance and time. List of targets is on target_file tgt_id = 11 # Working file paths gps_file = '/home/user/Downloads/gps_stream' target_file = '/hom...
cjsaiz89/UDP_GPS_Conky_display
mypositionV4.1.py
mypositionV4.1.py
py
6,857
python
en
code
0
github-code
54
14517379944
import sys from pycosat import solve from pysat.card import CardEnc, EncType from graph import newGraph from verificateur import verificateur3Coloration def solve3Coloration(graph, isVerbose): """ Résout le problème 3-Coloration :param isVerbose: :param graph: graphe G :return: cherche s'il existe une clique d...
romain22222/INFO003-TP2
part2/src/solve3Coloration.py
solve3Coloration.py
py
2,162
python
fr
code
0
github-code
54
34013770951
# if文 val = 20 if val >= 10: print("10より大きい") v1 = 10 v2 = v1 print(v1, v2) if v1 == v2: print("v1とv2は同じ") v2 = 20 print(v1, v2) if v1 == v2: print("v1とv2は同じ") else: print("v1とv2は違う値") if v1 > 100: print("v1は100より大きい") elif v1 > 50: print("v1は50より大きい") else: print("v1は50以下") if 100 >= v1 >= ...
ogutetsu/PythonSample
Learn/Control.py
Control.py
py
1,560
python
ja
code
0
github-code
54
26573416504
import re def mot_correspondant(mot:str,motif:str)->bool: """[summary] verifie si un motif et present dans mot Args: mot (str):mot fournit motif (str): motif peux contenir des jokers (.) Returns: bool: True si motif present False sinon """ correspond = False if re.matc...
malo2b/AtelierProgrammation4SPI
ex4.py
ex4.py
py
5,560
python
fr
code
0
github-code
54
11816181535
from statistics import mean from par import parse_args, set_paras, set_files, set_basic_info import pandas as pd import math import matplotlib.pyplot as plt1 import matplotlib.pyplot as plt2 import numpy as np if __name__ == '__main__': args = parse_args() set_paras(args) set_files(args) set_basic_in...
mikele700/ExplainableRecommendation
UniWalk-1.0/src/PrecisionRecall.py
PrecisionRecall.py
py
2,967
python
en
code
0
github-code
54
10673932093
''' Created on 23.09.2019 @author: TKler ''' from NIPSChallenge.NIPSNetwork import NIPSNetwork import numpy as np import matplotlib.pyplot as plt import SafeData def weightsPerInput(nw): number_of_input = nw.number_of_input_units weights_from_input = nw.input_to_hidden_all for i in range(...
BenteCodes/learnedwalking
NIPSChallenge/Analyser.py
Analyser.py
py
1,881
python
en
code
0
github-code
54
10492741761
import torch import math import numpy as np class LabelGuessor(object): def __init__(self, thresh): self.thresh = thresh def __call__(self, model, ims, balance, delT): org_state = { k: v.clone().detach() for k, v in model.state_dict().items() } is_train...
lnsmith54/BOSS
PT-BOSS/label_guessor.py
label_guessor.py
py
2,646
python
en
code
36
github-code
54
29544279396
from tabnanny import verbose import pycoexp.tasks import pandas as pd import re import os import numpy as np import shutil import scipy.optimize as optimize import utilities as u import plot as pl task = pycoexp.tasks.tasks() def setEa_andA(filepath_CPSmodel, Ea, A, filepath_updated): A['NaMN'] = A['NAMN'] Ea...
MolecularBioinformatics/thermophilesNAD
python_codes/simulation.py
simulation.py
py
15,533
python
en
code
0
github-code
54
16030106825
import logging from argparse import ArgumentParser from concurrent.futures import ThreadPoolExecutor from typing import Any, List, Tuple from os import path, makedirs from scripts.processing.lib.utils import find_files, chunks, exists, load, store from scripts.processing.lib.clean import clean_text from scripts.source...
AlexGustafsson/word-frequencies
scripts/processing/clean.py
clean.py
py
3,882
python
en
code
0
github-code
54
73367376161
from rest_framework import serializers from django.contrib.auth.models import User from . import models from product.models import ProductType class UserSerializer(serializers.ModelSerializer): class Meta: model = User fields = ('id', 'username', 'first_name', ...
ferily7/info441-manufacturing
final/auth/serializers.py
serializers.py
py
1,745
python
en
code
0
github-code
54
35937839246
from flask_wtf import FlaskForm from wtforms import StringField, IntegerField, TextAreaField, SelectField, BooleanField from wtforms.validators import InputRequired, URL, Optional, NumberRange class AddPetForm(FlaskForm): """Form for adding a pet""" name = StringField("Pet's Name", validators=[ ...
nasjones/flask-wtforms
forms.py
forms.py
py
1,215
python
en
code
0
github-code
54
20700156646
from typing import List import torch.nn as nn import torch.nn.functional as F class Solution(nn.Module): def __init__(self): super(Solution, self).__init__() ## TODO: Define all the layers of this CNN, the only requirements are: ## 1. This network takes in a square (same width and height...
MartinBCN/KeypointDetection
src/model/models.py
models.py
py
10,033
python
en
code
0
github-code
54
3321739820
"""Example - Calculate field map using multiprocessing A 3D field map is calculated in coordinates defined by the arrays x, y and z for a built-in undulator model. Multiprocesing parameters are: nproc: number of processes used. Generally, the more processes, the better up to the available threads in the ...
lnls-ima/insertion-devices
examples/fieldmap_parallel.py
fieldmap_parallel.py
py
1,643
python
en
code
1
github-code
54
16293576185
import firebase_admin from firebase_admin import credentials from firebase_admin import firestore import pandas as pd from datetime import datetime def add_to_collection(collection_name, dic_list, fs_client): """Adds a list of dictionaries to a collection in firestore Considers that the firebase_admin app is ...
ArthurVerrez/ngt-technical-test
case_study/cloud/aggregate_subscribed_redeemed_checks.py
aggregate_subscribed_redeemed_checks.py
py
1,817
python
en
code
1
github-code
54
34062753164
# import pytest # from selenium import webdriver # from selenium.webdriver.common.by import By # from selenium.webdriver.support.ui import WebDriverWait # from selenium.webdriver.support import expected_conditions as EC import time # import pytest from Page_Objects.loginPage import Login from Page_Objects.pipeline_Crea...
Ajithinoaura/Odoo_CRM_Automation
Test_Cases/test_Pipeline_Create.py
test_Pipeline_Create.py
py
3,450
python
en
code
0
github-code
54
14573748955
"""""" # Standard library modules. # Third party modules. from django.db import models # Local modules. # Globals and constants variables. class RunState(models.TextChoices): NOT_STARTED = "not started" RUNNING = "running" ERROR = "error" FAILED = "failed" SUCCESS = "success" SKIPPED = "sk...
ppinard/django-cd
django_cd/models.py
models.py
py
1,445
python
en
code
1
github-code
54
70269170722
from sqlalchemy import Float, Column, Integer, String from database import Base class Message(Base): __tablename__ = 'message' id = Column(Integer, primary_key=True, index=True, unique=True) date = Column(String) title = Column(String, unique=True, index=True) count_of_x = Column(Integer) len...
Xanssun/Fast_api_app
app/models/message.py
message.py
py
347
python
en
code
0
github-code
54
31571033063
import unittest from unittest.mock import patch from parameterized import parameterized from src.app import check_document_existance, get_doc_shelf, get_doc_owner_name, get_all_doc_owners_names, add_new_shelf documents = [ {"type": "passport", "number": "2207 876234", "name": "Василий Гупкин"}, {"type": "invoi...
LucasSteinach/py_adv_hw6
tests/test_unittest.py
test_unittest.py
py
1,886
python
en
code
0
github-code
54
19593638658
from flask import Flask, render_template, request # This program controls an interactive menu for ordering food. app = Flask(__name__) # This function takes the list of items ordered by the customer and converts the list to a string # that can be displayed when they submit their order. It also adds commas a...
jewicker/first_flask_app
menu.py
menu.py
py
1,614
python
en
code
0
github-code
54
74332156322
from bottle import * from sys import argv import json,urllib.request info = {'title':'Elsneytis Fyrirtæki','companies':[],'all_prices_bensin95':[],'all_prices_diesel':[],'all_locations':[]} with urllib.request.urlopen('http://apis.is/petrol') as data: api = json.loads(data.read().decode()) flag = 'dud' for i in...
Frillion/midway_project
app.py
app.py
py
1,699
python
en
code
0
github-code
54
15965883075
T = int(input()) for test_case in range(1, T+1): arr = list(input().split()) result = [] #result = list() for i in range(len(arr)): temp_char = arr[i][0] result.append(temp_char.upper()) print("#{} ".format(test_case), end = '') for x in result: print(x, end =...
Youngjae-park/Study-Algorithm
acronym.py
acronym.py
py
337
python
en
code
0
github-code
54
37468403452
# -*- coding: utf-8 -*- from bs4 import BeautifulSoup as bs import requests from selenium import webdriver import time song_list_info=[]#存放全部歌曲列表 song_download_url=[]#经过筛选处理后得到的真正的歌曲下载链接 headers={ 'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.5...
ZhuMengMeng666/KugouSpider
text.py
text.py
py
1,652
python
en
code
2
github-code
54
31749536148
import numpy as np from matplotlib import pyplot as plt from autokin.robot import SofaRobot from autokin.trayectorias import coprime_sines from autokin.utils import restringir n_samples = 5000 q = coprime_sines(2, n_samples, densidad=6)#2,8 # Buenos valores: [6:10] q = restringir(q) fig = plt.figure() n_dim = q.s...
DaMadApe/AutoKin
autokin/demos/demo_espacio_actuacion.py
demo_espacio_actuacion.py
py
764
python
en
code
0
github-code
54
35748597623
import pygame as pg import game_functions as gf import sys def check_events(stats, buttons, sounds): """Check and apply all user input""" # Check all input events in queue for event in pg.event.get(): # If user clicks exit button, quit game if event.type == pg.QUIT: sys.exit() ...
mattizatt140/Python
Tetris/ask_if_scoreboard_functions.py
ask_if_scoreboard_functions.py
py
1,726
python
en
code
0
github-code
54
8187519428
import argparse from subprocess import call import os import torch from modules.page_retriever_cc import WikiPageRetriever from modules.embedding_generator_cc import EmbeddingGenerator def get_args(): parser = argparse.ArgumentParser( description="Generate embeddings of CC Wiki entries.") parser.add...
lucasn42/lucien
scripts/generate_embeddings_cc.py
generate_embeddings_cc.py
py
2,189
python
en
code
0
github-code
54
9803951245
# coding: utf-8 # In[9]: """ Create table with result, raw ma10 and ols with geometries. ------------------------------------------------------------------------------- Create postGIS table for selected basins with all ma_10 indicators Author: Rutger Hofste Date: 20180622 Kernel: python35 Docker: rutgerhofste/gisd...
wri/Aqueduct30Docker
notebooks/qa/Y2018M06D22_RH_QA_result_PostGIS_V01.py
Y2018M06D22_RH_QA_result_PostGIS_V01.py
py
5,658
python
en
code
13
github-code
54
879808869
""" add ActionsStatistics table Revision ID: cb928c34d36c Revises: 2db1d0557b06 Create Date: 2019-12-06 09:33:12.210295 """ import sqlalchemy as sa from alembic import op revision = 'cb928c34d36c' down_revision = '2db1d0557b06' def upgrade(): op.create_table('actions_statistics', sa.Column('time', sa.Integ...
fedora-copr/copr
frontend/coprs_frontend/alembic/versions/cb928c34d36c_add_actionsstatistics_table.py
cb928c34d36c_add_actionsstatistics_table.py
py
675
python
en
code
95
github-code
54
41265604827
import argparse import gerber from gerber.primitives import Region, Rectangle, Line from pathlib import Path def convert(gerber_filename, to_mm=False): gerber_path = Path(gerber_filename) gerber_file = gerber.read(gerber_path) # Find just the SMD pads smd_pads = [p for p in gerber_file.primitives if ...
nebraska-silicon-lab/pcb_designs
Tools/gerber-to-kicad-footprint/main.py
main.py
py
3,208
python
en
code
0
github-code
54
14171408219
from django.shortcuts import render, redirect from django.contrib.auth.forms import UserCreationForm from django.contrib import messages from .forms import UserRegistrationFom from shop.models import Cart from django.contrib.auth.models import User def register(request): if request.method == 'POST': form ...
espatatis/readaholic
users/views.py
views.py
py
959
python
en
code
0
github-code
54
34633767533
import torch import os import logging import base64 import io import json from PIL import Image import numpy as np import torchvision from torchvision import transforms device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') COMPILED_FILE = 'compiled.pt' UNCOMPILED_FILE = 'model.pth' logger = logging.get...
YoussefAmrSoliman/Dogbreed-Image_calssification
inference.py
inference.py
py
1,255
python
en
code
0
github-code
54
73443956321
#!/usr/bin/env python3 import logging import os import argparse from ctypes import cdll, Structure, c_uint16, c_char_p, c_int, c_size_t, string_at, c_bool, CFUNCTYPE from threading import Thread class String(Structure): _fields_ = [("ptr", c_char_p), ("size", c_size_t)] @classmethod def fro...
i96751414/torrest-cpp
bindings/python/libtorrest.py
libtorrest.py
py
5,016
python
en
code
10
github-code
54
6561102318
import matplotlib matplotlib.use('Agg') from statiskit import stl from statiskit import core from statiskit.data import core as data import unittest from nose.plugins.attrib import attr import os from tempfile import NamedTemporaryFile import math @attr(linux=True, osx=True, win=True, level=1) cla...
Global-localhost/Core-2
test/test_sample_space.py
test_sample_space.py
py
3,524
python
en
code
null
github-code
54
2239044413
#!/usr/bin/env python # -*- coding: utf-8 -*- # author:ShidongDu time:2020/1/27 ''' 输入一个链表的头结点,按照 从尾到头 的顺序返回节点的值。 返回的结果用数组存储。 样例 输入:[2, 3, 5] 返回:[5, 3, 2] ''' # Definition for singly-linked list. class ListNode(object): def __init__(self, x): self.val = x self.next = None # 方法一:栈 class Solution...
weiyuyan/LeetCode
剑指offer/面试题6.从尾到头打印链表.py
面试题6.从尾到头打印链表.py
py
1,006
python
en
code
2
github-code
54
30467944829
import turtle # create turtle object t = turtle.Turtle() # change the drawing speed t.speed(0) t.penup() t.goto(-400, 250) t.pendown() # Orange Rectangle # white rectangle t.color("orange") t.begin_fill() t.forward(800) t.right(90) t.forward(167) t.right(90) t.forward(800) t.end_fill() t.left(90) ...
gargvivek24/python_dummy_project
indian_flag.py
indian_flag.py
py
1,336
python
en
code
0
github-code
54
29771326160
#!/usr/bin/env python from esiaf_doa.doa_wrapper import DOA import pyesiaf import rospy from esiaf_ros.msg import RecordingTimeStamps, AugmentedAudio, SSLDir, SSLInfo # config import yaml import sys # util import StringIO def msg_to_string(msg): buf = StringIO.StringIO() msg.serialize(buf) return buf.g...
Slothologist/esiaf_doa
scripts/start_doa.py
start_doa.py
py
3,006
python
en
code
0
github-code
54
15979179747
from http import HTTPStatus from django.test import Client, TestCase from django.urls import reverse from ..models import Group, Post, User class PostCreateFormTests(TestCase): @classmethod def setUpClass(cls): super().setUpClass() cls.author = User.objects.create_user(username='TestAuthor')...
BankaiSS/hw04_tests
yatube/posts/tests/test_forms.py
test_forms.py
py
2,548
python
en
code
0
github-code
54
33322820240
prompt = input("Enter a text:") rotation_integer = int(input("Enter a key in range of 1-25:")) encoding = '' ALPHABET = 'abcdefghijklmnopqrstuvwxyz' for i in range(len(prompt)): cha = prompt[i] if cha in ALPHABET: current_i = ALPHABET.find(cha) new_i = (current_i + rotation_integer)%26 n...
Chamikacp/A-Histrogram-for-Exam-Marks-and-Encoding-Decoding-a-message
part2a.py
part2a.py
py
466
python
en
code
2
github-code
54
26740906722
from tkinter import * #main root = Tk() #creating a label myLabelWithGrid = Label(root, text="Hello, let\'s go anywhere") myName = Label(root, text = "Umm, let's stay at home only it\'s covid! ") #so what the grid does is that it fixes the position of the label at the given (row,column) co-ordinate myLabelWithGrid....
ansh8tu/GUI-using-Tkinter
tkinter101/2_grid.py
2_grid.py
py
427
python
en
code
0
github-code
54
31527231860
import socket import sys import threading import os from des import des key = "keyyyyyy" d = des() def read_msg(sock_cli): while True: # terima pesan data = sock_cli.recv(65535) if len(data) == 0: break decoded_data = data.decode('utf-8') username, msg = decod...
prolifel/des-chat
client.py
client.py
py
1,963
python
en
code
0
github-code
54
41597768655
num = cont = soma = 0 print("\033[31mDigite 999 se deseja parar\033[m") num = int(input("Digite um numero: ")) #ler o flag do lado de fora while num != 999: soma += num cont += 1 num = int(input("Digite um numero: ")) # e ler o flag do lado de dentro print("Você digitou {} números".format(cont)) print("A s...
RaianePedra/CodigosPython
MUNDO 2/DESAFIO64.py
DESAFIO64.py
py
385
python
pt
code
0
github-code
54
22246371336
#!/usr/bin/env python3 #----------------------------------------------------------------- # Create a plot for the Riemann IVP #----------------------------------------------------------------- import numpy as np from matplotlib import pyplot as plt import matplotlib params = { 'axes.labelsize': 12, 'axes.ti...
mladenivkovic/debugging-essentials-demo
exercise/theory/figures/linear_advection_solution.py
linear_advection_solution.py
py
1,556
python
en
code
1
github-code
54
21299023207
from airflow import DAG from airflow.operators.email_operator import EmailOperator from datetime import timedelta,datetime from airflow.operators.dummy_operator import DummyOperator default_args = { 'owner':'anand_21', 'depends_on_past':False, 'start_date':datetime(2022,3,10), 'email':['divya2103anand@...
Jatin-futurense/airflow-dags
dags/EmailOperator.py
EmailOperator.py
py
976
python
en
code
1
github-code
54
2991480453
class Solution: def groupAnagrams(self, strs: List[str]) -> List[List[str]]: anagrams = {} for s in strs: p = list(s) p.sort() p = "".join(p) slist = anagrams.get(p, []) slist.append(s) anagrams[p]...
n5596/Cracking-the-Coding-Interview
Chapter 10: Sorting and Searching/02: Group Anagrams.py
02: Group Anagrams.py
py
480
python
en
code
0
github-code
54
18681817431
import logging import os import redis import riprova from rq import Worker, Queue, Connection listen = ['high', 'default', 'low'] redis_url = os.getenv('REDIS_URL', 'redis://localhost:6379') conn = redis.from_url(redis_url) logger = logging.getLogger(__name__) def on_retry(err, next_try): logger.warning('Ope...
ondiekisteven/whatsappbot
tasks.py
tasks.py
py
637
python
en
code
0
github-code
54
17719951440
# -*- mode: python -*- from kivy.deps import sdl2, glew from kivy.tools.packaging.pyinstaller_hooks import get_deps_all, hookspath, runtime_hooks block_cipher = None a = Analysis(['main.py'], # pathex=['D:\\tmp\\desktopapp'], pathex=['C:\\users\\username\\appdata\\local\\programs...
Skuratau/desktopapp
main.spec
main.spec
spec
1,533
python
en
code
0
github-code
54
2909755497
"""Создание класса "Телефонная книга" с атрибутами "имя", "номер телефона". Реализовать методы для добавления и удаления контакта, изменения данных контакта, вывода информации о всех контактах, а также поиска контакта по имени. """ # импортируем класс class Phonebook: contacts = [] def __init__(self, name, num...
TatyanaLM/my_repo
Python part 2/part 2 lesson 4/Hometasks/task 3.py
task 3.py
py
2,232
python
ru
code
0
github-code
54
23171658765
#!/usr/bin/python3 # Reader class for UraLex files import io import os import sys import zipfile import urllib.request import csv DATA_MAIN_FILE = 'Data.tsv' LANGUAGE_FILE = 'Languages.tsv' MLISTS_FILE = 'Meaning_lists.tsv' MNAMES_FILE = 'Meanings.tsv' MISSING_VALUES ...
kasyrj/uralex-export
reader.py
reader.py
py
10,609
python
en
code
0
github-code
54
73086083041
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None # Inorder traversal # Left -> Root -> Right # Preorder traversal # Root -> Left ->Right # Postorder traversal # Left ->Right -> Root class...
chenshanghao/LeetCode_learning
Problem_94/my_solution_new.py
my_solution_new.py
py
838
python
en
code
0
github-code
54
38614499408
from odoo import api, fields, models, _ class WebsiteNotifiyConfigSettings(models.Model): _name = 'website.notifiy.config.settings' _description = "Website Notify Config Settings" @api.model def _get_default_cron(self): cron_id = self.env.ref('website_stock_notifiy.ir_cron_stock_notify_email_...
Doscaal/Dentanor
Doscaal/website_stock_notifiy/models/res_config.py
res_config.py
py
2,096
python
en
code
0
github-code
54