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
538444678
text_based = ["perspective_score", "identity_attack", "sentiment", "Please", "Please_start", "HASHEDGE", "Indirect_(btw)", "Hedges", "Factuality", "Deference", "Gratitude", "Apologizing", "1st_person_pl.", "1...
null
main/get_feature_set.py
get_feature_set.py
py
922
python
en
code
null
code-starcoder2
51
106691790
with open('file_sample.txt', 'rb') as f: lines = [x.strip() for x in f.readlines()] count = 0 for line in lines: tmp = line.strip().lower() words = tmp.replace(b'line',b'Line') print(words) for word in words: if(word == 'line'): count= count+1 print('Count: '+str(count)) # The ...
null
byte_like_error/bytelikeerror_split.py
bytelikeerror_split.py
py
550
python
en
code
null
code-starcoder2
51
514071216
#!/usr/bin/env python import json from pprint import pprint from robot_localization.srv import SetPose from geometry_msgs.msg import PoseWithCovarianceStamped from mavros_msgs.srv import StreamRate from std_msgs.msg import Bool import sys import rospy import importlib class TaskPlanner: NODE_NAME = 'task_plan...
null
catkin_ws/src/task_planning/scripts/task_planner.py
task_planner.py
py
3,511
python
en
code
null
code-starcoder2
51
625845206
#!/usr/bin/env python # ******************************* PLEASE DO NOT MODIFY ******************************* import os with open('testCases.txt') as fp: for line in fp: if not line.isspace(): if line.startswith("TEST CASES FOR"): parsedLine = line.split() currF...
null
ucsd-cse30/pa/pa3-jams-master/runTests.py
runTests.py
py
2,441
python
en
code
null
code-starcoder2
51
442610606
""" Pisano Period In number theory, the nth Pisano period, written π(n), is the period with which the sequence of Fibonacci numbers taken modulo n repeats. https://en.wikipedia.org/wiki/Pisano_period """ import tortoise_and_hare2 as th def fib_seq(n): """Returns a fibonacci sequence from 1 to n""" nums = [0...
null
algorithms/cycle_detection/pisano_period.py
pisano_period.py
py
762
python
en
code
null
code-starcoder2
51
330718015
import glob import requests import json import ExperimentBoiler import geoDonorMinimiser import geoBiosampleMinimiser import urlparse import sys from time import sleep HEADERS = {'accept': 'application/json'} GET_HEADERS = {'accept': 'application/json'} POST_HEADERS = {'accept': 'application/json', 'C...
null
src/report_script.py
report_script.py
py
4,239
python
en
code
null
code-starcoder2
51
125082187
#! usr/bin/env python3 #encoding: utf-8 import functools def log(text=None): def decorator(func): @functools.wraps(func) def wrapper(*args,**kw): if isinstance(text,str): print('%s %s()'%(text,func.__name__)) _func=func(*args,**kw) else: ...
null
decorator.py
decorator.py
py
627
python
en
code
null
code-starcoder2
51
564388264
from pytorch_metric_learning import losses, miners, trainers import numpy as np import pandas as pd from torchvision import datasets, models, transforms import torch.nn as nn import torch.optim import logging from torch.utils.data import Dataset from PIL import Image from cub2011 import Cub2011 from mobilenet...
null
example_MetricLossOnly.py
example_MetricLossOnly.py
py
12,910
python
en
code
null
code-starcoder2
51
458758221
# -*- coding: utf-8 -*- # pylint: disable=missing-docstring,too-many-public-methods,invalid-name,protected-access,no-self-use """ ListView pagination tests. """ import math from common.peewee_model import SystemPlatform from manager.base import InvalidArgumentException from manager.list_view import ListView from .vul...
null
tests/manager_tests/test_links.py
test_links.py
py
8,667
python
en
code
null
code-starcoder2
51
318137463
"""This module implements a two-stage HMAX-like model. This module implements a multi-scale analysis by applying single-scale Gabors to a scale pyramid of the input image. This is similar to the configuration used by Mutch & Lowe (2008). """ # Copyright (c) 2011 Mick Thomure # All rights reserved. # # Please see the...
null
glimpse/models/ml/model.py
model.py
py
4,757
python
en
code
null
code-starcoder2
51
63604089
from common import * import autograd.numpy as np import matplotlib.pyplot as plt import autograd.numpy.random as rng from autograd.numpy.random import multivariate_normal as rmvn from autograd.numpy.linalg import cholesky, solve from autograd.scipy.linalg import cholesky as chol from autograd.scipy.linalg import solve_...
null
exp/circgp/gpexact.py
gpexact.py
py
3,065
python
en
code
null
code-starcoder2
51
529240850
import sys sys.path.append('C:\E\mysoft\python-workSpace\pythons\test-dash2') import pandas as pd import pymysql from sshtunnel import SSHTunnelForwarder from sqlalchemy import create_engine from pyecharts.charts import Bar from example.commons import Faker from pyecharts import options as opts from pyecharts.charts im...
null
manager/pyecharts_results.py
pyecharts_results.py
py
12,969
python
en
code
null
code-starcoder2
51
96202310
import json import pickle from argparse import ArgumentParser from pathlib import Path from typing import Dict, Tuple import pandas as pd import numpy as np from pandas import DataFrame from sklearn.ensemble import GradientBoostingRegressor from sklearn.metrics import mean_squared_error def rmse(a, b): return np....
null
code/src/evaluate.py
evaluate.py
py
3,225
python
en
code
null
code-starcoder2
51
323630674
import collections from typing import Deque import re #정규표현식 불러오기 class Solution: def isPalindrome(self, s: str) -> bool: strs = [] for char in s: if char.isalnum(): # isalnum(): 영문자, 숫자 여부 판별하여 False, True 변환 strs.append(char.lower()) # 모든 문자 소문자 변환하여 str에 입력 ...
null
python_algorithm/python_algorithm_06/Array/isPalindrome.py
isPalindrome.py
py
1,593
python
en
code
null
code-starcoder2
51
139529264
from ..models import Measurement def get_measurements(): queryset = Measurement.objects.all().order_by('-dateTime')[:10] return (queryset) def create_measurement(form): measurement = form.save() measurement.save() return () def create_measurement_object(variable_id, value, unit, place): measu...
null
measurements/logic/logic_measurements.py
logic_measurements.py
py
506
python
en
code
null
code-starcoder2
51
581952654
#!/usr/bin/python3 import sys # stdout enumerate from itertools import * # chain from_iterable product from math import * # sqrt floor ceil gcd from copy import copy, deepcopy from collections import * # Counter defaultdict deque from queue import Queue from heapq import heappush, heappop, heapify from operator impor...
null
algorithms/greedy/fighting_pits.py
fighting_pits.py
py
2,013
python
en
code
null
code-starcoder2
51
290709786
# coding: utf-8 # Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. """ This module provides classes to interface with the Crystallography Open Database. If you use data from the COD, please cite the following works (as stipulated by the COD developers):: Merkys, A., Vaitk...
null
pymatgen/ext/cod.py
cod.py
py
5,029
python
en
code
null
code-starcoder2
51
86064595
# coding=UTF-8 #%matplotlib inline import visa import time import datetime import numpy as np N=50 ppsvalue=np.array([5.50, 5.00, 4.5, 3.60, 3.30, 3.00, 2.70, 2.20]) rm = visa.ResourceManager() pps=rm.open_resource('GPIB0::6::INSTR') cnter= rm.open_resource('GPIB0::3::INSTR') print(pps.query('*MODEL?')) print(cnter.q...
null
array_test.py
array_test.py
py
1,009
python
en
code
null
code-starcoder2
51
511044401
import datetime import matplotlib.pyplot as plt data = [] x = [] y = [] with open('forplot') as file: for i in file.readlines(): splitted = i.split() datestr = splitted[0]+' '+splitted[1] date = datetime.datetime.strptime(datestr, '%Y-%m-%d %H:%M:%S.%f') # 2020-02-25 12:29:46.040 dat...
null
lab2/plot.py
plot.py
py
717
python
en
code
null
code-starcoder2
51
355372996
# -*- coding: utf-8 -*- import pandas as pd data = pd.read_csv('../Dataset/datalog.csv') col_list = ['학점', '토익', '토스', 'OPIC', '외국어', '해외경험', '인턴', '수상경력'] # ["Index","학점", "토익", "토스", "OPIC", "외국어", "자격증", "해외경험", "인턴", "수상경력","봉사","합격여부"] # Index,학점,토익,토스,OPIC,외국어,자격증,해외경험,인턴,수상경력,봉사,합격여부 # index,grades,toeic,...
null
Pretreatment/pretreatment.py
pretreatment.py
py
2,581
python
en
code
null
code-starcoder2
51
204443424
import re import json import glob for filpath in glob.glob('LTETrace************'): with open(filpath, 'r') as ltefile: ignore = {'Zeit', '>>>>>>>>>>>>>>>>>>>>>>>>', '!GSTATUS: ', '!LTEINFO:', '--', '2017'} onestring = {'EMM', 'RRC', 'IMS', 'SINR', 'InterFreq', 'LTE CA state', 'GSM', 'WCDMA', 'CDM...
null
LTE_converter.py
LTE_converter.py
py
3,809
python
en
code
null
code-starcoder2
51
571468285
from starlette.routing import Router, Route from starlette.requests import Request from starlette.authentication import requires from omo.views import template_env, template from omo.db import database from omo.middlewares import COOKIES_SESSION_TOKEN_KEY @requires('authenticated', redirect='login') async def my_acco...
null
omo/routes/accounts.py
accounts.py
py
1,263
python
en
code
null
code-starcoder2
51
277593907
#Code to run a quantum random number generator on a real quantum device. from qiskit import QuantumCircuit, IBMQ, execute #Authenticate an account and add for use during this session. IBMQ.enable_account("YOUR_API_TOKEN") provider = IBMQ.get_provider(hub='ibm-q') #Initialize the number of qubits and classical registe...
null
quantum_coins.py
quantum_coins.py
py
726
python
en
code
null
code-starcoder2
51
382494602
from typing import Any, Dict, Iterable, cast from openslides_backend.action.actions.meeting.shared_meeting import ( meeting_projector_default_replacements, ) from tests.system.action.base import BaseActionTestCase class MeetingCreateActionTest(BaseActionTestCase): def basic_test(self, datapart: Dict[str, Any...
null
tests/system/action/meeting/test_create.py
test_create.py
py
6,420
python
en
code
null
code-starcoder2
51
253042468
from flask import Flask, request, abort from linebot import (LineBotApi, WebhookHandler) from linebot.exceptions import (InvalidSignatureError) from linebot.models import * from engine.currencySearch import currencySearch from engine.AQI import AQImonitor from engine.gamma import gammamonitor from engine.OWM import O...
null
app.py
app.py
py
9,282
python
en
code
null
code-starcoder2
51
262289428
# import libraries import urllib.request from bs4 import BeautifulSoup from selenium import webdriver import json from pymongo import MongoClient import sys import time sys.stdout = open('file', 'w', encoding="utf-8") url = "https://www.nike.com/w/new-shoes-3n82yzy7ok" # run firefox webdriver from executable path of ...
null
scraper.py
scraper.py
py
2,187
python
en
code
null
code-starcoder2
51
334827427
import urllib3, json, requests, keyboards from setting import bot_token, chat_id_service, rest_link_product, rest_link_store, rest_link_stock import telebot from telebot import types import barcode import time, datetime, schedule from configparser import ConfigParser import os from os import path from mysql.connector i...
null
main.py
main.py
py
33,479
python
en
code
null
code-starcoder2
51
122696024
""" Project 1 - Degree distributions for graphs Part of Algorithmic Thinking (Part 1) on Coursera (coursera.org) """ EX_GRAPH0 = { 0: set([1, 2]), 1: set([]), 2: set([]) } EX_GRAPH1 = { 0: set([1, 4, 5]), 1: set([2, 6]), 2: set([3]), 3: set([0]), 4: set([1]), 5: set([2]), 6: set...
null
problems/coursera/1-graph_degree/graph_degree.py
graph_degree.py
py
2,148
python
en
code
null
code-starcoder2
51
55379322
# coding: utf-8 import requests import polling import asyncio import logging from aiohttp import ClientSession from time import sleep class ShutterManager: def __init__(self, address): self.address = address self.logger = logging.getLogger('blebox.ShutterManager') def __repr__(self): ...
null
blebox/shutter.py
shutter.py
py
1,955
python
en
code
null
code-starcoder2
51
312064231
from keras.preprocessing.image import ImageDataGenerator, array_to_img, img_to_array, load_img from keras import backend as keras import numpy as np import os import glob import cv2 def merge_and_save(): imgtype = "jpg" train = glob.glob("results/*."+imgtype) for i in range(len(train)): if i is not 54 and i is n...
null
first/merge_imgs.py
merge_imgs.py
py
1,806
python
en
code
null
code-starcoder2
51
430322468
import SimpleITK as sitk import numpy as np from scipy.spatial.transform import Rotation as R from dltk.io.preprocessing import whitening """ img: simpleitk input image angle: radian angle to rotate around the z axis size: voxel size for resampled data """ def rotate_image(img, angle, size=[64, 64, 64], is_label=Fal...
null
preprocess.py
preprocess.py
py
6,419
python
en
code
null
code-starcoder2
50
439960465
#### My Solution Using Hashtable #### class FindElements: def __init__(self, root: TreeNode): self.hash_table = dict() self.decontaminate(root, 0) def decontaminate(self, root, value): if root == None: return else: root.val = value sel...
null
1261_Find_Elements_in_a_Contaminated_Binary_Tree.py
1261_Find_Elements_in_a_Contaminated_Binary_Tree.py
py
760
python
en
code
null
code-starcoder2
50
328176617
# test for convolution from conv import * import time if 'DEF_CONV' not in globals(): from transfer.conv import * def test_matrix(): x = np.array([[0.09, 0.0, 0.5], [0.2, 0.3, 0.08]]) m1 = Matrix(x) print(m1) x = np.array([[-0.09, 0.3, 0.07], [0.03, -0.3, 0.1]]) m2 = Matrix(x) print(m2) ...
null
transfer/t_conv.py
t_conv.py
py
885
python
en
code
null
code-starcoder2
50
316273474
""" given a string, return longest palindrome of the string assuming you can reorder all the letters """ def longest_palindrome(s): letter_count = {} for char in s: letter_count[char] = 1 if char not in letter_count else letter_count[char] + 1 multiple = [] single = [] for char, count in let...
null
google/longest_palindrome.py
longest_palindrome.py
py
652
python
en
code
null
code-starcoder2
50
139188028
import sys import socket def packet_capture_socket(): # the public network interface HOST = socket.gethostbyname(socket.gethostname()) # sniff traffic through all ports PORT = 0 # create a new socket instance, requires administrator privileges s = socket.socket(socket.AF_INET, socket.SOC...
null
data-scripts/network_sniffer.py
network_sniffer.py
py
847
python
en
code
null
code-starcoder2
51
107860284
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri May 10 01:15:02 2019 @author: chaztikov """ import os;import numpy as np;import pandas as pd import os,sys,re,subprocess import pandas as pd import numpy as np import scipy import scipy.integrate from scipy.spatial import KDTree from scipy.interpolate ...
null
leaflet_flutter_data/ex1/aorta_data.py
aorta_data.py
py
11,467
python
en
code
null
code-starcoder2
51
85595004
import csv import statistics import math_functions.stock_functions as stock_functions import math_functions.math_functions as math_functions file_path = 'D:/finance_data/data_test.csv' data = [] daily_returns = [] first_row = True with open(file_path, newline='') as csvfile: spamreader = csv.reader(csvfile, de...
null
Generic_Finance_Predictor_OLD/learning_tutorials_and_testing/computational_investing/data_manipulation_demo.py
data_manipulation_demo.py
py
1,468
python
en
code
null
code-starcoder2
51
113401861
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals, print_function #A HistoryGraph Immutable Object import uuid from .changetype import * from . import fields from operator import itemgetter import hashlib import six class ImmutableObject(object): is_singleton = False def __ini...
null
historygraph/immutableobject.py
immutableobject.py
py
2,190
python
en
code
null
code-starcoder2
51
18697883473
cost = [] items = [] all_items = [] total = int total = 0 numitems = int(input('Enter the number of items you will be calculating')) for i in range(0, numitems, 1): items.append(i) items[i] = int(input('please enter how much each item is (from start to finish)')) total = items[i] + total print(items)...
johnbuttigieg/Code
Week 3 Workshop/shippingCalc.py
shippingCalc.py
py
486
python
en
code
0
github-code
13
74272001937
# Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html # useful for handling different item types with a single interface from itemadapter import ItemAdapter from datetime import datetime from wikiSpider....
danyow-cheung/data-analysis-etc
Python网络爬虫权威指南/wikiSpider/wikiSpider/pipelines.py
pipelines.py
py
1,260
python
en
code
0
github-code
13
21599376655
from PyQt4 import QtGui from PyQt4 import QtOpenGL from PyQt4 import QtCore import numpy as np from OpenGL.GL import * import mathutils as mth import time from OpenGL.GL import * from OpenGL.GLU import * from OpenGL.GLUT import * import CNST.techs as techs import CNST.clGEOOBJ as clGEOOBJ from CNST.draw import getmv ...
bakeryproducts/ConstructorM4
glwidget.py
glwidget.py
py
23,768
python
en
code
2
github-code
13
32417429548
# -*- coding: utf-8 -*- """ Created on Mon Dec 18 13:09:36 2017 @author: Ryan McMahon """ import pickle import re import pandas as pd from utils import fightinwords ######################### ### 0) LEMMAS ######################### # 0.0a) Read in lemma DTM build with open("D:/cong_text/robust/DTMs/unilem_dtmbuild...
rymc9384/PartyOfSpeech
06-robustness/01-unigrams/03-partisan_unigram_lemmas.py
03-partisan_unigram_lemmas.py
py
1,985
python
en
code
0
github-code
13
69796288018
import numpy as np from scipy.integrate import odeint import matplotlib.pyplot as plt # copy number c = 0 # cooperativity of repressor binding n = 1.0 # transcription rates amRcas9 = 1.0 asgRNA = 1.0 aGmax = 1.0 aGmin = 0.0001 # degradation rates ysgRNA = 0.1 ymRcas9 = 0.2 ycas9 = 0.2 yR = 0.1 ymRG = 0.2 yG = 0.2 # tr...
igem-thessaloniki/model
CAS9/model.py
model.py
py
1,755
python
en
code
0
github-code
13
20296192704
""" desitarget.cmx.cmx_targetmask ============================= This looks more like a script than an actual module. """ from desiutil.bitmask import BitMask from desitarget.targetmask import load_mask_bits _bitdefs = load_mask_bits("cmx") try: cmx_mask = BitMask('cmx_mask', _bitdefs) cmx_obsmask = BitMask('c...
desihub/desitarget
py/desitarget/cmx/cmx_targetmask.py
cmx_targetmask.py
py
412
python
en
code
17
github-code
13
74638339536
# Quick sort - Hoare partition scheme # 피벗은 가장 첫 번째 값으로 설정한다. def quick_sort(array, start, end): # 원소가 1개인 경우 이미 정렬된 상태이다. if start >= end: return pivot = start left = start + 1 right = end while left <= right: # 피벗보다 큰 데이터가 나오기 전까지 반복 while left <= end and array...
codehikerstudy/interview-question
MrKeeplearning/algorithm/src/quick_sort_hoare.py
quick_sort_hoare.py
py
1,243
python
ko
code
0
github-code
13
327182231
import pybio import os import sys import pickle cache_data = {} def cache_string(string): if cache_data.get(string, None)==None: cache_data[string] = string return string else: return cache_data[string] class Gtf(): def __init__(self, filename): self.genes = {} sel...
grexor/pybio
pybio/data/Gtf.py
Gtf.py
py
2,777
python
en
code
7
github-code
13
22929309866
#from dataclasses import dataclass from typing import List #@dataclass #class year:# Klasse zum Speichern von Daten eines Jahres. # year:int # months:List[float] class year: year:int months:List[float] def __init__(self, year, months): self.year = year self.months = months #@data...
CSideStep/climate_project_school
read_data.py
read_data.py
py
6,432
python
en
code
0
github-code
13
34895565229
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Jul 7 19:46:02 2019 @author: yaoweili """ import numpy as np import matplotlib.pyplot as plt import matplotlib.collections as mcoll import tensorflow as tf ''' This file contains functions as follow: | functions | Usage ...
geekleahhh/1-D-DeconvNet-for-ECG-signals
functions.py
functions.py
py
3,025
python
en
code
0
github-code
13
16987987668
class Solution: def topKFrequent(self, words, k): """ :type words: List[str] :type k: int :rtype: List[str] """ wordCount = {} for word in words: if word not in wordCount: wordCount[word] = 0 wordCount[word] += 1 ...
HzCeee/Algorithms
LeetCode/heap/692_TopKFrequentWords.py
692_TopKFrequentWords.py
py
607
python
en
code
0
github-code
13
8114603022
#! /usr/bin/env python # -*- coding: utf-8 -*- """a converter from AI0 feature to AJ1 feature""" # The implementation is very incomplete and very very ugly. import sys, re from collections import namedtuple from enum import Enum class GsubFragmentType(Enum): UNKNOWN = 0 CID = 1 FROMBY = 2 OTHE...
derwind/fontUtils
ai0_to_aj1/mk_features.py
mk_features.py
py
18,230
python
en
code
1
github-code
13
41264713114
class Solution: def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool: n, m = len(word1), len(word2) word1Pointer, word2Pointer = 0, 0 string1Pointer, string2Pointer = 0, 0 while word1Pointer < n and word2Pointer < m: if...
AshwinRachha/LeetCode-Solutions
1662-check-if-two-string-arrays-are-equivalent/1662-check-if-two-string-arrays-are-equivalent.py
1662-check-if-two-string-arrays-are-equivalent.py
py
862
python
en
code
0
github-code
13
7579147660
import boto3 import time glue = boto3.client('glue') table_name = 'my_table' job_name = f'job_for_{table_name}' print(f"Starting Glue job: {job_name}") glue.start_job_run(JobName=job_name) status = 'STARTING' while status in ['STARTING', 'RUNNING']: time.sleep(10) response = glue.get_job_run(JobName=job_...
abhi1094/cdk-sample-projects
start_glue_job.py
start_glue_job.py
py
567
python
en
code
0
github-code
13
28824711366
#Load dataset from sklearn import datasets iris = datasets.load_iris() print(iris['feature_names']) print(iris['target_names']) print(iris['data'][0]) print(iris['target'][0]) #split data into train and test data #currently taking only 3 records for testing one for each # flower type located at 0, 50 and 100 line in ...
mansikataria/MachineLearning
Classification/IrisClassificationUsingDecisionTreeScikitLearn.py
IrisClassificationUsingDecisionTreeScikitLearn.py
py
786
python
en
code
1
github-code
13
73662990736
import xgboost as xgb import numpy as np from ConfigSpace.configuration_space import ConfigurationSpace from ConfigSpace.hyperparameters import UniformFloatHyperparameter, \ UniformIntegerHyperparameter, CategoricalHyperparameter from alphaml.utils.constants import * from alphaml.engine.components.models.base_model...
dingdian110/alpha-ml
alphaml/engine/components/models/regression/xgboost.py
xgboost.py
py
4,152
python
en
code
1
github-code
13
41224922726
import torch import os from utils.utilGeneral import * import random def my_is_NAN(input_list: list): for ts in input_list: a = torch.max(ts).item() if np.isnan(a): return True b = torch.min(ts).item() if np.isnan(b): return True return Fal...
xxin1984/x-parser
utils/utilTorch.py
utilTorch.py
py
5,051
python
en
code
4
github-code
13
20349643090
import logging import sys import asyncio from kademlia.Node import Node # This script is used to launch non-interactive nodes. They can only # bootstrap, and can't be issued commands. They are created by the # simulation.sh script to help analyze network behaviour def prompt(): print("'set <key (str)> <value (...
rowan-maclachlan/cmpt-434-proj
kad.py
kad.py
py
4,039
python
en
code
0
github-code
13
73151538256
#!/usr/bin/env python """Create a csv matrix of distances between shapefile geometry objects. Requirements: fiona, shapely Written by: Taylor Denouden Date: November 25, 2015 """ from __future__ import print_function import sys import fiona from shapely.geometry import shape from multiprocessing import Pool, cpu_cou...
tayden/Island_MST
shp_to_csv_distances.py
shp_to_csv_distances.py
py
2,530
python
en
code
0
github-code
13
41182052000
import numpy as np import theano import os from dml import * from dml.knearest import * import common from common import * import random DIR_SPECIES = 'datas/fishes_species' classFolders = [dirName for dirName, e, files in os.walk(DIR_SPECIES) if len(dirName) > 2 + len(DIR_SPECIES)] IMG_SHAPE = (50, 50) IMG_COLOR_SHA...
webalorn/TIPE
code/nnets/fishesClass/manyClassSiamese.py
manyClassSiamese.py
py
3,158
python
en
code
1
github-code
13
41113879331
# # tokenize a file with spacy tokenizer -> so that we don't have to do it on the fly # ------------------------------- # # usage: # python matchmaker/preprocessing/tokenize_files.py --in-file <path> --out-file <path> --reader-type <labeled_tuple or triple> import argparse import os import sys sys.path.append(os.getcw...
sebastian-hofstaetter/sigir19-neural-ir
matchmaker/preprocessing/tokenize_files.py
tokenize_files.py
py
3,115
python
en
code
45
github-code
13
24661551694
# import get_string from cs50 library from cs50 import get_string # define main function def main(): # ask user for a text text = get_string("Text: ") # create a dict with measures and initial values results = {"letter_count": 0, "word_count": 1, "sentence_count": 0} # count letters, words and se...
juliankohr/CS50x
07_week_06_python/07_sentimental-readability/readability.py
readability.py
py
1,565
python
en
code
0
github-code
13
28765808434
d = {} for i in range(int(input())): s = input().split() for i in s: if i not in d: d[i] = 1 else: d[i] += 1 sort_d = {k: v for k, v in sorted(d.items(), key=lambda item: item[1], reverse=True)} max = 0 second = 0 for k, v in sort_d.items(): max = v break for k, v in sort_d.items(): ...
CuongNguyen291201/py
frequentword.py
frequentword.py
py
440
python
en
code
0
github-code
13
20411004489
#!/usr/bin/env python3 import csv import glob import os import re _filename_re = re.compile(r'log_([0-9]+)x([0-9]+)_f([0-9]+)_replay([0-9]+)_r([0-9]+)_0[.]log') def parse_basename(filename): match = re.match(_filename_re, filename) assert match is not None return match.groups() _replay_re = re.compile(r'...
StanfordLegion/resilience
experiment/parse_replay.py
parse_replay.py
py
1,254
python
en
code
0
github-code
13
32688005882
import botocore def new_boto_exception(exception_constructor): """ Get a new boto3 exception of the specified type with a mock exception message. The mock exception message will look like this: >>> 'An error occurred (MockError) when calling the MockOperation operation: mock message' Example...
aws/aws-gamekit-unreal
AwsGameKit/Resources/cloudResources/functionsTests/helpers/boto3/mock_responses/exceptions.py
exceptions.py
py
1,369
python
en
code
68
github-code
13
31732074040
__author__ = 'Indra Gunawan' from ladon.compat import PORTABLE_STRING from ladon.ladonizer import ladonize import math import re import collections from ladon.types.ladontype import LadonType temp3 = [] tempc = [] tempoftemp = [] tempoftimec = [] hit = 0 flag = 0 nama_server = "DWI_SERVER" class LogCron(object):...
ardinusawan/Sistem_Terdistribusi
Web-Service/SOAP/serverLadon.py
serverLadon.py
py
3,365
python
en
code
0
github-code
13
72123485457
# Date : 2016.08.05 # Author : yqtao # https://github.com/yqtaowhu class Solution: def strStr(self, source, target): if source is None or target is None: return -1 for i in range(len(source) - len(target) + 1): for j in range(len(target)): if source[i + j...
yqtaowhu/programming
leetcode/implementStrStr/implementStrStr.py
implementStrStr.py
py
422
python
en
code
2
github-code
13
20971471376
import numpy as np import biosppy.signals as bsig DEVICE_SAMPLING_RATE = {'muse': 256, # is this right? is it 220 Hz (see documentation)? } def get_channels(signal, channels, device='muse'): """ Returns a signal with only the desired channels. Arguments: signal: a sign...
lukasbauer3091/alpha-light
streamStaffCode/classification_tools.py
classification_tools.py
py
3,448
python
en
code
1
github-code
13
35654419418
import cv2 from banknote import note_colors from standalone.homography import find_match image_final = None notes_list = [] current_note = None sift = cv2.xfeatures2d.SIFT_create() def compute_homography(image, template_path, callback, debug=False): points_list = [] #img_final = cv2.imread(image_path, 1) # ...
Blondwolf/NoteCounterCHF
src/aborted/standalone/video.py
video.py
py
2,252
python
en
code
0
github-code
13
8105742062
# Background Subtraction has several use cases in everyday life, # It is being used for object segmentation, security enhancement, # tracking, counting the number of visitors, number of vehicles in traffic etc. # It is able to learn and identify the foreground mask. # The popular Background subtraction algorithms a...
tanmaysgs/OpenCVPractice
15.backgroundSubtraction.py
15.backgroundSubtraction.py
py
1,131
python
en
code
0
github-code
13
27213148412
''' 创建一个有10个数字的列表,先输出此列表,然后输出其中的偶数元素 ''' import random List=[random.randint(1,50) for i in range(20)] print(List) for i in List: if(i%2==0): print(i,end=' ')
xiao-ying19/zzh
exe/exe_1.11/if_else.py
if_else.py
py
230
python
zh
code
0
github-code
13
27995863179
from datetime import date import json from flask_jwt_extended import get_jwt_identity from models.transaction import Transaction from dao import account_dao from dao import budget_dao from flask import Blueprint, jsonify, request from flask_jwt_extended import jwt_required account_blueprint = Blueprint('account', __na...
mason-wolf/penny-budget
api/account.py
account.py
py
4,061
python
en
code
0
github-code
13
17042879894
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * from alipay.aop.api.domain.VcpUniqueInfo import VcpUniqueInfo class AlipayMarketingVoucherBatchqueryModel(object): def __init__(self): self._biz_codes = None self._create_end_time = Non...
alipay/alipay-sdk-python-all
alipay/aop/api/domain/AlipayMarketingVoucherBatchqueryModel.py
AlipayMarketingVoucherBatchqueryModel.py
py
9,627
python
en
code
241
github-code
13
72922352977
from rest_framework.serializers import ModelSerializer, HyperlinkedIdentityField, SerializerMethodField, ImageField from shops.models import Shop, create_slug from comments.serializers import CommentSerializer from comments.models import Comment from products.serializers import ProductSerializer from products.models...
mskw23/shopsapi
shops/serializers.py
serializers.py
py
4,586
python
en
code
0
github-code
13
10722506816
import sys from os import path, makedirs from shutil import rmtree from charmhelpers.core import hookenv from hashlib import sha256 from shell import shell from nginxlib import get_app_path def download_archive(): """ """ # Get the nginx vhost application path app_path = get_app_path() config = ...
adam-stokes/juju-charm-wordpress-hhvm
lib/wordpresslib.py
wordpresslib.py
py
1,182
python
en
code
0
github-code
13
71446779217
import speech_recognition as sr import moviepy.editor as mp from pathlib import Path import os def google_transfer(wavFilePath): try: r = sr.Recognizer() audio = sr.AudioFile(wavFilePath+'.wav') with audio as source: audio_file = r.record(source) result = r.recognize_goo...
davidyuan666/CaseAudioParser
speechRecongize.py
speechRecongize.py
py
1,327
python
en
code
0
github-code
13
25943030030
from Individuo import * import numpy as np import math import random class IndividuoReal(Individuo): def __init__(self, tam, minB, maxB, fitFunc, funcResultado): self.min_bound = minB self.max_bound = maxB self.cod = "REAL" self.cromossomo = self.init_cromossomo(tam) self.f...
mbalatka/OCEV
IndividuoReal.py
IndividuoReal.py
py
6,807
python
pt
code
0
github-code
13
9373485455
from __future__ import annotations from ipaddress import IPv4Address, IPv4Network from cloudshell.cp.core.cancellation_manager import CancellationContextManager from cloudshell.cp.core.rollback import RollbackCommand, RollbackCommandsManager from cloudshell.cp.core.utils.name_generator import NameGenerator from clou...
QualiSystems/cloudshell-cp-openstack
cloudshell/cp/openstack/os_api/commands/create_instance.py
create_instance.py
py
3,442
python
en
code
0
github-code
13
73120112017
qnt = 0 lista = list() while True: num = int(input('digite um número: ')) while num not in lista: lista.append(num) qnt += 1 escolha = str(input('deseja continuar?[S/N] ')).upper() if escolha == 'N': break print('você digitou {} elementos'.format(qnt)) lista.sort(reverse=True) pr...
henrique340/pythonProject4
desafio 81.py
desafio 81.py
py
497
python
pt
code
0
github-code
13
4937465551
from itertools import combinations import random jugadores = ["Dani", "David", "Enano", "Cocinera", "Alexis", "Gafas", "Mauricio", "Jaimito"] # Variables para almacenar los partidos y las posiciones partidos = [] posiciones = {jugador: {"Puntos": 0, "PG": 0, "PE": 0, "PP": 0, "GF": 0, "GC": 0} for jugador in jugadore...
mauricioatm20/Python
resultados y clasificacion.py
resultados y clasificacion.py
py
3,178
python
es
code
0
github-code
13
21263758894
from flask import Flask, request, redirect, render_template, session, flash from mysqlconnection import MySQLConnector import re app = Flask(__name__) mysql = MySQLConnector(app,'mydb') app.secret_key = 'Brandon' @app.route('/') def index(): if not 'email' in session: session['email']='' if not 'valid'...
bwal91/Brandon
Python(completed)/myEnvironments/flask_mysql/Email/server.py
server.py
py
975
python
en
code
0
github-code
13
15219767172
#!/usr/bin/python import random import string def main(): # create a string to hold lower case alphabet letters = string.ascii_lowercase # create file objects to manipulate opened/created files f1 = open("file1.txt", "w") f2 = open("file2.txt", "w") f3 = open("file3.txt", "w") # put file obje...
solorzao/CS344-Operating-Systems
ProgramPy-PythonExploration/mypython.py
mypython.py
py
1,675
python
en
code
0
github-code
13
18129373492
# -*- coding: utf-8 -*- """ Created on Mon Nov 4 17:11:49 2019 @author: HP """ import re _KEYWORDS = ["class", "method", "function", "constructor", "int", "boolean", "char", "void", "var", "static", "field", "let", "do", "if", "else", "while", "return", "true", "false", "null", ...
naveenls/nand2tetris
Tokenizer.py
Tokenizer.py
py
3,219
python
en
code
0
github-code
13
17041298174
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class AlipayFundTransCollectSinglemoneytokenCreateModel(object): def __init__(self): self._biz_context = None self._collect_mode = None self._expire_date = None self._ex...
alipay/alipay-sdk-python-all
alipay/aop/api/domain/AlipayFundTransCollectSinglemoneytokenCreateModel.py
AlipayFundTransCollectSinglemoneytokenCreateModel.py
py
5,476
python
en
code
241
github-code
13
41807350765
print("this file is deprecated") exit import argparse as parse import numpy as np import plotly.graph_objects as go import os import permittivitycalc as pc import src.plot_layout as plot_layout import src.agent as agent import scipy.signal as signal import datetime time=datetime.datetime.now().strftime('%Y-%m-%d-%H-%...
zueskalare/panglin_prj
.trash/outpt.py
outpt.py
py
2,557
python
en
code
0
github-code
13
31740719595
# -*- coding: utf-8 -*- # @Time : 2023/9/26 16:19 # @Author : nanji # @Site : # @File : testHandWriteDigit.py # @Software: PyCharm # @Comment :3. 性能度量——逻辑回归+手写数字分类手写数字分类 from sklearn import datasets from sklearn.preprocessing import StandardScaler from sklearn.model_selection import train_test_split digit...
lixixi89055465/py_stu
machinelearn/stu02/testHandWriteDigit.py
testHandWriteDigit.py
py
3,754
python
en
code
1
github-code
13
25497964151
from fastapi import APIRouter, Depends, HTTPException from api.dependencies import ( get_sys_map_service, get_sys_map_update_service, get_audit_log_service, ) from schemas.system_mapping_schema import SystemMappingCurrent, SystemMappingUpdates from api.requests import system_mapping_requests from services.s...
gerald-eai/product-config-poc
pcp-poc-app/server/src/api/router/system_mapping_endpoints.py
system_mapping_endpoints.py
py
5,917
python
en
code
0
github-code
13
14585319910
from json import dumps from kafka import KafkaProducer import sys import re import csv import sys if len(sys.argv)>1: day = sys.argv[1] day = day[-8:-4] + '-' + day[-14:-9] + 'T00:00:00' else: day = None if len(sys.argv)>2: bserver = sys.argv[2] else: bserver = "localhost:9092" if len(sys.argv)...
knguyen93/cs523
python/kafka/pycode/sendkafka.py
sendkafka.py
py
2,385
python
en
code
0
github-code
13
28904001718
# coding:utf-8 import matplotlib.pyplot as plt from wordcloud import WordCloud from bs4 import BeautifulSoup import requests import MeCab as mc import os def mecab_analysis(text): t = mc.Tagger("-Ochasen -d /usr/local/lib/mecab/dic/mecab-ipadic-neologd/") t.parse('') node = t.parseToNode(text) output...
pauwau/workspace
Environment_BD/Senseless/2channel/badword/makeWordCloud.py
makeWordCloud.py
py
2,025
python
en
code
0
github-code
13
9118852652
from django.urls import path from django.views.generic import TemplateView from rest_framework.documentation import include_docs_urls from rest_framework import routers from . import views app_name = 'web' urlpatterns = [ path('', views.home, name='home'), path('', views.ReactView.as_view(), name='react_objec...
hittapa63/django-finance-dwolla-plain
apps/web/urls.py
urls.py
py
1,225
python
en
code
0
github-code
13
23455605673
#1 calculate & print the value of function y = 2x^2 + 2x + 2 for x=[56, 57, ... 100] (0.5p) import math for i in range(56, 101): print('The value of function for i=', i, 'is', 2*i**2+2*i+2) #2 ask the user for a number and print its factorial (1p) print('Insert your value here:') x = int(input()) factorial = 1 ...
mstolars/maja_stolarska_231016
maja_stolarska_zadania/lab1/1_3_zadania.py
1_3_zadania.py
py
851
python
en
code
0
github-code
13
42526799247
import matplotlib.pyplot as plt import pandas as pd data = pd.read_csv('data.csv') #reading the CSV Data File print(list(data.columns.values)) #Producing the list of variables the user can choose x = str(input("Select the x-axis variable ")) #Choosing the firse variable type = str(input("Type of graph? Scat...
towseefhossain/Pandas_Fifa19
FIFA.py
FIFA.py
py
1,561
python
en
code
0
github-code
13
38221413982
from typing import Callable, Optional import time from pyhazel.config import * from dataclasses import dataclass from io import TextIOWrapper from functools import wraps from threading import Lock import time import json __all__ = [ "HZ_PROFILE_BEGIN_SESSION", "HZ_PROFILE_END_SESSION", "HZ_PROFILE_SCOPE", ...
twje/pyhazel
src/pyhazel/debug/instrumentor.py
instrumentor.py
py
4,220
python
en
code
2
github-code
13
15483207134
import numpy as np from math import floor import scipy.ndimage as ndimage def postprocess(surface): surface = surface / np.amax(surface) alpha = 0.75 surface = np.power(surface, alpha) surface = ndimage.gaussian_filter(surface, sigma=2, order=0) norm = np.linalg.norm(surface) surface = surface...
parakalan/RagaRecognition
surface_generation.py
surface_generation.py
py
1,284
python
en
code
11
github-code
13
3301356336
import websocket import ast import matplotlib.pyplot as plt import json def on_error(wsapp, message): """ A function to print any error messages """ print(message) pit_volume = 0 #initializing some variables incrementalRevenue=0 names=0 def on_message(wsapp, message): """ A function ca...
Lord-Protector/EOG_HackUTD
node version/eog.py
eog.py
py
6,646
python
en
code
0
github-code
13
18430050833
"""Pretraining on TPUs.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import os from absl import app from absl import flags import absl.logging as _logging # pylint: disable=unused-import import numpy as np import tensorflow as tf from xlnet import...
SebiSebi/xlnet
train.py
train.py
py
4,350
python
en
code
null
github-code
13
33172372670
class Node: def __init__(self, item_name, size): self.children = {} self.name = item_name self.size = size def addChild(self, child_name, child_node): self.children[child_name] = child_node def totalSize(self): total = self.size for (_, c) in self.children.ite...
alexvy86/advent-of-code
2022/day7.py
day7.py
py
1,820
python
en
code
0
github-code
13
42137381293
#kata link: https://www.codewars.com/kata/550498447451fbbd7600041c #Instruction : Given two arrays a and b write a function comp(a, b) (orcompSame(a, b)) that checks whether the two arrays have the "same" elements, with the same multiplicities. # "Same" means, here, that the elements in b are the elements in a squ...
ianbeltrao/CodeWars
6 kyu/Are_they_the_same.py
Are_they_the_same.py
py
723
python
en
code
0
github-code
13
2876882398
import collections from io import TextIOWrapper import os import pathlib import shutil import tempfile import tarfile from typing import DefaultDict, List, Optional, Tuple import xml.etree.ElementTree as ET from docuploader import log, shell, tar from docuploader.protos import metadata_pb2 from google.cloud import sto...
googleapis/doc-pipeline
docpipeline/generate.py
generate.py
py
16,625
python
en
code
10
github-code
13
22453914339
from .models import User, Transaction from django.db.models import ( F, Q, Sum, Case, When, FloatField, Subquery, OuterRef ) from .util import get_prices, monetaryConversor def balance(userID): user_data = User.objects.get(pk=userID) portfolio = user_data.investiments.order_by("-date").all().annotate( ...
carlosjosedesign/finance
finance/balance.py
balance.py
py
5,351
python
en
code
0
github-code
13
71997909457
import numpy as np class PostProcess(): #initalization def __init__(self,pageshape): self.shape = pageshape # h,w # process(sort,removing duplicate etc.) the horizontal/vertical lines in the page def sort_by_index(self,lines,index): if not len(lines): re...
wetleaf/Pdf_To_Text
code/postprocess.py
postprocess.py
py
3,925
python
en
code
0
github-code
13
37478260945
import torch import torch.nn as nn class Actor(nn.Module): def __init__(self, obs_dim, action_dim, hidden_dim = 256): super(Actor, self).__init__() self.fc = nn.Linear(obs_dim, hidden_dim) self.value = ResNet(hidden_dim, 1, 2, output_dim=1) self.policy = nn.Linear(hidden_dim, actio...
Gurvan/GoHighFox
models.py
models.py
py
2,203
python
en
code
4
github-code
13