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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
4449615890 | import tensorflow as tf
import tensorflow_datasets as tfds
import numpy as np
from tensorflow import keras
from keras.preprocessing.text import Tokenizer
from keras.preprocessing.sequence import pad_sequences
imdb,info = tfds.load("imdb_reviews",with_info=True, as_supervised=True)
train_data,test_data = imdb['train']... | Atharva500/imdbReviews | imdb_reviews.py | imdb_reviews.py | py | 2,348 | python | en | code | 0 | github-code | 36 |
13368558436 | # In[1]:
import os
import sys
import random
import math
import re
import time
import numpy as np
import cv2
import matplotlib
import matplotlib.pyplot as plt
import pdb
from PIL import Image
# Root directory of the project
ROOT_DIR = os.path.abspath("../")
# Root directory of the dataset
DATA_DIR = '../images/trash_te... | BoSmallEar/Roberto | roberto_mask_rcnn/src/test_roberto.py | test_roberto.py | py | 10,913 | python | en | code | 0 | github-code | 36 |
31070431709 | import xlsxwriter
from tkinter import *
from openpyxl import load_workbook
myFileName = 'decmo.xlsx'
# load the workbook, and put the sheet into a variable
wb = load_workbook(filename=myFileName)
newRowLocation = 1
global index
index = 1
def functionate():
v = e.get()
vv = f.get()
d ... | utsabbuet17/My-Wallet | xl (1).py | xl (1).py | py | 2,168 | python | en | code | 2 | github-code | 36 |
37522076505 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import fingerfood as fd
from os import remove, path
# testing texts
text_01 = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis finibus metus quam, eget pulvinar ligula viverra vitae. Duis egestas vitae diam ac sodales. Mauris mattis lacinia sodales. Aliquam vit... | suxinyan/fingerfood | tests.py | tests.py | py | 3,858 | python | en | code | 0 | github-code | 36 |
16172958687 | """ This script is an example of benchmarking the continuous mlp baseline."""
import datetime
import os
import os.path as osp
import random
from baselines.bench import benchmarks
import dowel
from dowel import logger as dowel_logger
import gym
import pytest
import tensorflow as tf
from metarl.envs import normalize
fr... | icml2020submission6857/metarl | tests/benchmarks/metarl/tf/baselines/test_benchmark_continuous_mlp_baseline.py | test_benchmark_continuous_mlp_baseline.py | py | 4,736 | python | en | code | 2 | github-code | 36 |
25358805817 | '''
Created on 2018年11月21日
@author: Jacky
'''
from random import randint
from collections import Counter
from pip._vendor.msgpack.fallback import xrange
import re
data = [randint(60,100) for _ in xrange(30)]
dt1 = dict.fromkeys(data, 0)
print(dt1)
for x in data:
dt1[x]+=1
print(dt1)
lst = sort... | jackyzhou2k/jackypy | lesson2/le23.py | le23.py | py | 579 | python | en | code | 0 | github-code | 36 |
7297989640 | # Mappings for the FHIR class generator.
#
# This should be useable as-is for Python classes.
# Which class names to map to resources and elements
classmap = {
'Any': 'Resource',
'Practitioner.role': 'PractRole', # to avoid Practinioner.role and PractitionerRole generating the same class
'boolean': ... | smart-on-fhir/fhir-parser | Default/mappings.py | mappings.py | py | 2,083 | python | en | code | 147 | github-code | 36 |
8347565838 | def make_counter():
"""Return a counter function.
>>> c = make_counter()
>>> c('a')
1
>>> c('a')
2
>>> c('b')
1
>>> c('a')
3
>>> c2 = make_counter()
>>> c2('b')
1
>>> c2('b')
2
>>> c('b') + c2('b')
5
"""
"*** YOUR CODE HERE ***"
s={}
d... | iyezhiyu/CS61A | hw06/vitamin/vitamin06.py | vitamin06.py | py | 3,379 | python | en | code | 0 | github-code | 36 |
70116366823 |
# coding: utf-8
# # Assignment 2
#
# Before working on this assignment please read these instructions fully. In the submission area, you will notice that
# you can click the link to **Preview the Grading** for each step of the assignment. This is the criteria that will be used
# for peer grading. Please familiarize ... | dimaggiofrancesco/DATA_VISUALISATION-UK-climate-record | UK daily climate record.py | UK daily climate record.py | py | 9,092 | python | en | code | 1 | github-code | 36 |
72071718183 | import re
from sql_interpreter.sql import SQL_REGEX_COLUMN, SQL_REGEX_COLUMN_ALIAS
class Column:
def __init__(self, columns_str: str) -> None:
if 'as' in columns_str.lower():
patron = re.compile(SQL_REGEX_COLUMN_ALIAS, re.I)
matcher = patron.search(columns_str)
self.co... | ElDwarf/sql-interpreter | sql_interpreter/sql/select_component.py | select_component.py | py | 914 | python | en | code | 0 | github-code | 36 |
32854853808 | from ProjectUtils import *
from gym import spaces
from gym.utils import seeding
import numpy as np
from math import floor
import gym
from keras.models import Sequential, Model
from keras.layers import Dense, Activation, Flatten, Input, Concatenate, LSTM
from keras.optimizers import Adam
from pandas.plotting import re... | GoldwinXS/TradingBot | TradingAgent.py | TradingAgent.py | py | 20,141 | python | en | code | 0 | github-code | 36 |
32001421881 | # 변수 할당 참조.
class Solution:
def minCostToMoveChips(self, positions: List[int]) -> int:
odd, even = 0, 0
for i in positions:
if i % 2 == 0:
even += 1
else:
odd += 1
return min(even, odd)
| plan-bug/LeetCode-Challenge | microcephalus7/categories/greedy/1217.sol2.py | 1217.sol2.py | py | 283 | python | en | code | 2 | github-code | 36 |
35548038833 | def solution(n, m, section):
answer = 0
before = 0
for i in range(1,len(section)):
if section[i] - section[before] < m :
continue
else :
before = i
answer += 1
return answer+1 | ckswls56/BaejoonHub | 프로그래머스/unrated/161989. 덧칠하기/덧칠하기.py | 덧칠하기.py | py | 252 | python | en | code | 0 | github-code | 36 |
33039005896 | from mc.net.minecraft.level.tile.LiquidTile import LiquidTile
from mc.net.minecraft.level.liquid.Liquid import Liquid
class CalmLiquidTile(LiquidTile):
def __init__(self, tiles, id_, liquid):
super().__init__(tiles, id_, liquid)
self._tileId = id_ - 1
self._calmTileId = id_
self._s... | pythonengineer/minecraft-python | mc/net/minecraft/level/tile/CalmLiquidTile.py | CalmLiquidTile.py | py | 1,251 | python | en | code | 2 | github-code | 36 |
30013425796 | #!/usr/bin/env python3
import os
import os.path as op
import json
import logging
from gear_toolkit import gear_toolkit_context
from utils import args
log = logging.getLogger(__name__)
def main(context):
# Build and Execute Parameters
try:
# build the command string
params = args.build(conte... | flywheel-apps/pydeface-gear | run.py | run.py | py | 901 | python | en | code | 0 | github-code | 36 |
35659485468 | """The services validators test module."""
import pytest
from django.core.exceptions import ValidationError
from django.db.models import QuerySet
from moneyed import EUR, USD, Money
from services.models import Service
from services.validators import (validate_service_location,
validat... | webmalc/d8base-backend | services/tests/validators_tests.py | validators_tests.py | py | 1,855 | python | en | code | 0 | github-code | 36 |
42005693188 | from pyspark.sql import SparkSession
from pyspark import SparkContext, SparkConf
from pyspark.sql.functions import col, udf
from pyspark.sql.types import IntegerType, BooleanType, NullType, StringType
import os
from credentials import *
# Adding the packages required to get data from S3
os.environ["PYSPARK_SUBMIT_AR... | meedaycodes/pinterest-data-processing-pipeline | batch_processing.py | batch_processing.py | py | 3,678 | python | en | code | 1 | github-code | 36 |
12641098982 | class MtlMaterialNewmtl:
def __init__(self, input: str):
data = input.split(" ")
if len(data) != 2:
raise Exception
if data[0].lower() != "newmtl":
raise Exception
self.__header = "newmtl"
self.__value = data[1]
def getHeaderValue(self):
... | noburing64/tobidas-world-core | app/domain/entity/mtl_material/newmtl.py | newmtl.py | py | 376 | python | en | code | 0 | github-code | 36 |
70847912423 | """A simple QoS app for Django"""
__author__ = 'Anthony ZuluPro Monthe'
__email__ = 'anthony.monthe@gmail.com'
__license__ = 'BSD'
__url__ = 'https://github.com/cloudmercato/django-qos'
VERSION = (0, 1, 0)
__version__ = '.'.join([str(v) for v in VERSION])
default_app_config = 'django_qos.apps.DjangoQosConfig'
| cloudmercato/django-qos | django_qos/__init__.py | __init__.py | py | 313 | python | en | code | 0 | github-code | 36 |
14963556209 | #!/usr/bin/env python3
import serial
import sys
import argparse
import logging
from logging.config import fileConfig
fileConfig('log.ini', defaults={'logfilename': 'bee.log'})
logger = logging.getLogger('openscale')
if sys.version_info<(3,4,2):
sys.stderr.write("You need python 3.4.2 or later to run this script\n... | jenkinsbe/hivekeepers | get_weight.py | get_weight.py | py | 4,093 | python | en | code | 0 | github-code | 36 |
74114075623 | import frappe,json
@frappe.whitelist()
def get_receipt_shipments(doc):
doc=json.loads(doc)
shipments=[]
for receipt in doc.get('purchase_receipts'):
for receipt_item in frappe.get_all("Purchase Receipt Item",filters={"parent":receipt.get("receipt_document")},fields=["purchase_order"],group_by="purchase_order"):
... | Bizmap-Technologies-Pvt-Ltd/mfi_customization- | mfi_customization/mfi/doctype/landed_cost_voucher.py | landed_cost_voucher.py | py | 4,299 | python | en | code | 0 | github-code | 36 |
5673773090 | from abc import ABC, abstractmethod
from typing import List, Optional
from rlf.forecasting.data_fetching_utilities.coordinate import Coordinate
from rlf.forecasting.data_fetching_utilities.weather_provider.api.models import Response
class BaseAPIAdapter(ABC):
"""Abstract base class for APIAdapter objects"""
... | orion-junkins/river-level-forecasting | src/rlf/forecasting/data_fetching_utilities/weather_provider/api/base_api_adapter.py | base_api_adapter.py | py | 2,430 | python | en | code | 3 | github-code | 36 |
10775024526 | # coding=utf-8
import FreeCAD,Draft,ArchComponent,DraftVecUtils,ArchCommands,math
from FreeCAD import Vector
if FreeCAD.GuiUp:
import FreeCADGui
from PySide import QtCore, QtGui
from DraftTools import translate
else:
def translate(ctxt,txt):
return txt
def makeSphere(radius, name="Sphere"):
... | rainmanzj/C3DPlatform | Mod/C3DPlatform/View/Feature/SphereViewImpl.py | SphereViewImpl.py | py | 1,881 | python | en | code | 0 | github-code | 36 |
34564591070 | import logging
import requests
from requests_cache import CachedSession
# Cached requests
rc = CachedSession(
"intrusion_monitor_http_cache", backend="sqlite", use_temp=True, expire_after=604800
)
def url_builder(ip, fields_id=66846719, base_url=False):
"""
The parameter `fields_id` encodes the followin... | afonsoc12/intrusion-monitor | intrusion_monitor/api.py | api.py | py | 2,088 | python | en | code | 2 | github-code | 36 |
27649475161 | from PySide2.QtGui import QColor, QLinearGradient, QPen, QBrush, QFont
HOVERED_SCALE = 1.2
EPSILON = 0.0001
SHAPE_STEPS = 100
ADD_MARKER_RADIUS = 7.0
ADD_MARKER_COLOR = (166, 210, 121)
SNAPPING_DISTANCE = 8.0
SHAPE_GRADIENT = QLinearGradient()
SHAPE_GRADIENT.setColorAt(0, QColor(165, 165, 165, 15))
SHAPE_GRADIENT.se... | igor-elovikov/hou-ramped | scripts/python/ramped/settings.py | settings.py | py | 549 | python | en | code | 4 | github-code | 36 |
5475708388 | import PIL.ImageGrab
import PIL.ImageOps
import PIL.ImageStat
from PIL import Image
import pytesseract
import numpy
import os
import time
import win32api, win32con
import skimage
import msvcrt
## IF SOMETHING GOES WRONG IT PROBABLY BECAUSE YOU LEVELED AND EMPTY TILE NO LONGER READ 'ae'
pytesseract.pytesseract.tesser... | FridayNguyen/UnderlordsAutomaton | automaton.py | automaton.py | py | 11,884 | python | en | code | 0 | github-code | 36 |
28630612376 | """volume_desc_length
Revision ID: 3719cf217eb9
Create Date: 2021-08-09 01:48:21.855229
"""
from alembic import op # noqa
import sqlalchemy as sa # noqa
import datetime # noqa
# revision identifiers, used by Alembic.
revision = '3719cf217eb9'
down_revision = '538bac81c28a'
branch_labels = None
depends_on = None
... | hashipod/icebox | core/icebox/dba/versions/0030_volume_desc_length.py | 0030_volume_desc_length.py | py | 560 | python | en | code | 0 | github-code | 36 |
7529076841 | import sys
from time import sleep
import serial
def touchForCDCReset(port="/dev/ttyACM0", *args, **kwargs):
"""Toggle 1200 bps on selected serial port to force board reset.
See Arduino IDE implementation:
https://github.com/arduino/Arduino/blob/master/arduino-core/src/processing/app/Serial.java
https... | ysard/libre-printer | firmware/restart_interface.py | restart_interface.py | py | 1,145 | python | en | code | 4 | github-code | 36 |
5775145740 | from flask import abort, request
from flask.ext.login import login_required
from webargs import fields
from webargs.flaskparser import use_args
from bauble.controllers.api import api
import bauble.db as db
from bauble.models import Accession, Location, Plant
from bauble.middleware import use_model
import bauble.utils ... | Bauble/bauble.web | bauble/controllers/api.OLD/plant.py | plant.py | py | 4,481 | python | en | code | 4 | github-code | 36 |
21143739816 | import numpy as np
from ipdb import set_trace
class InputExample:
def __init__(self, text, labels,entity_type_id=None):
self.text = text
self.labels = labels
self.entity_type_id = entity_type_id
class BaseFeature:
def __init__(self, token_ids, attention_masks, token_type_ids, raw_tex... | KeDaCoYa/MKG-GC | entity_extraction/src/dataset_util/base_dataset.py | base_dataset.py | py | 9,187 | python | en | code | 0 | github-code | 36 |
29403672645 | # -*- coding: utf-8 -*-
"""
Django settings for Rovercode Web project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
from __future__ import absolute_import, unico... | rovercode/rovercode-web | config/settings/common.py | common.py | py | 12,431 | python | en | code | 14 | github-code | 36 |
10916209180 | diagonal = 501
# diagonal number as 5 gave a total of 101 so I hope this is right!
run, level, corner, total = 0, 1, 4, 0
# "level" controls how many numbers to skip before adding and "run" to control when to increase the level
# "corner" to countdown for run
for i in range(1, (diagonal)**2 + 1):
if run == 0:
... | howelldx/Drew-Howell | week9/spiral.py | spiral.py | py | 481 | python | en | code | 0 | github-code | 36 |
73850400103 | import requests
from pprint import pprint
url = 'http://api.giphy.com/v1/gifs/search?api_key=4i1aScgdTDrEGFZuIltFlaHACRS0QWA6&q=경찰&limit=1'
url2 = ''
data = requests.get(url).json()
new_url = data['data'][0]['images']['downsized']['url']
pprint(data['data'][0]['images']['downsized']['url']) | blueboy1593/Django | Django_crud/연습.py | 연습.py | py | 299 | python | en | code | 0 | github-code | 36 |
40894674702 | # Copyright (c) 2002-2008 Infrae. All rights reserved.
# See also LICENSE.txt
# $Revision: 1.25 $
from StringIO import StringIO
from Globals import InitializeClass
from AccessControl import ClassSecurityInfo
from OFS.SimpleItem import SimpleItem
from Products.Silva.helpers import translateCdata
from Products.... | webbyfox/SilvaUCLLifeLearningContentTypes | silvaxmlattribute.py | silvaxmlattribute.py | py | 6,700 | python | en | code | 1 | github-code | 36 |
39845448432 | """
Iguana (c) by Marc Ammon, Moritz Fickenscher, Lukas Fridolin,
Michael Gunselmann, Katrin Raab, Christian Strate
Iguana is licensed under a
Creative Commons Attribution-ShareAlike 4.0 International License.
You should have received a copy of the license along with this
work. If not, see <http://creativecommons.org... | midas66/iguana | src/tag/forms.py | forms.py | py | 1,352 | python | en | code | null | github-code | 36 |
73694344104 | class Node():
def __init__(self, data):
self.data = data
self.next_node = None
class LinkedList():
def __init__(self):
self.head = None
def add_node(self,new_node):
#If head is absent, new node becomes head
if self.head is None:
... | Mannyvv/Algorithms_Practice | LinkedList.py | LinkedList.py | py | 1,131 | python | en | code | 0 | github-code | 36 |
6674479915 | import logging
from typing import Type, Tuple, Dict, List
import itertools
from collections import OrderedDict
import torch
import dace
from dace import data as dt
from daceml.autodiff.backward_pass_generator import BackwardPassGenerator
from daceml.autodiff.base_abc import AutoDiffException, BackwardResult
from dac... | spcl/daceml | daceml/autodiff/torch.py | torch.py | py | 5,716 | python | en | code | 69 | github-code | 36 |
3269951524 | """
Here is the implementation of quicksort algorithm in python by Pramod Bharti
quick_sort() function takes an unsorted array and prints sorted array
"""
def quick_sort(arr):
if len(arr) <= 1:
return arr
pivot = arr[len(arr) // 2]
left = [x for x in arr if x < pivot]
middle = [x for x in arr if x == pivot]
rig... | VAR-solutions/Algorithms | data structures/quick_sort.py | quick_sort.py | py | 484 | python | en | code | 733 | github-code | 36 |
27838730172 | import struct
from newsroom import jsonl
import os
from utils import preprocess_text
import parameters as p
import pandas as pd
import pickle as pkl
from tensorflow.core.example import example_pb2
import argparse
def trim_and_transform(example_generator, new_filename, transformation, constraint):
oldcount, newcoun... | dmcinerney/Summarization | preprocess.py | preprocess.py | py | 6,740 | python | en | code | 0 | github-code | 36 |
28518466371 | from flask import Blueprint, render_template, request, redirect
from database import mysql
# blueprint setup
update = Blueprint('update', __name__)
@update.route('/update')
def default():
book = {}
book['id'] = request.args.get('id')
book['name'] = request.args.get('name')
return render_template('... | micahluedtke/engineering_computation_data_science | HomeworkFour/withblueprint/update.py | update.py | py | 650 | python | en | code | 0 | github-code | 36 |
2153542183 | from os import popen
import sys
print(sys.argv[1]+" "+sys.argv[2])
a = popen("pactl list sink-inputs").read()
a = str(a).split("Sink Input")
for i in a:
if 'media.name = "'+sys.argv[1]+'"' in i or 'application.process.binary = "'+sys.argv[1]+'"' in i:
a = i
a = str(a).replace("\t","").split("\n")
sink = a[... | uXmuu/volume-control | volume_control.py | volume_control.py | py | 422 | python | en | code | 0 | github-code | 36 |
10828953580 | def solution(board):
answer = 0 # board의 값이 모두 0인 경우 check하기 위해 0으로 초기화
# (1,1)부터 위,왼쪽, 왼쪽 대각선의 좌표를 확인하면서 board 갱신
for i in range(1,len(board)):
for j in range(1,len(board[0])):
if board[i][j] != 0: # dp 적용
board[i][j] = min(board[i-1][j],board[i][j-1],board[i-1][j-... | choijaehoon1/programmers_level | src/test38.py | test38.py | py | 632 | python | ko | code | 0 | github-code | 36 |
1372129456 | #!/usr/bin/env python
# -*- coding: utf8 -*-
# author aliex-hrg
import threading,time
star_time = time.time()
def run1(n,k):
print(n)
time.sleep(k)
print('run done...',n)
t1 = threading.Thread(target=run1,args=("t1",1))
t1.setDaemon(True)
t1.start()
t2 = threading.Thread(target=run1,args=("t2",2))
t2.setDa... | hrghrghg/test | day8/eg_threading.py | eg_threading.py | py | 877 | python | en | code | 0 | github-code | 36 |
18562474998 | from django.shortcuts import render, redirect, render_to_response
from django.http import HttpResponse, HttpResponseRedirect
from django.template import Context
from todo.models import ToDo
from django.contrib.auth.models import User
from todo.forms import ToDoForm, AddUserForm, AddRecurringToDoForm, TransferToDoDate... | mscs-jpslaanan/project | todo/views.py | views.py | py | 11,185 | python | en | code | 0 | github-code | 36 |
2719779268 |
from itererators_and_generator.my_modules.my_iterators import LISTITERATOR
from itererators_and_generator.my_modules.my_generators import ListGENERATOR
nested_list = [
['a', 'b', 'c'],
['d', 'e', 'f', 'h', False],
[1, 2, None]
]
multi_nested_list = [[1, 2, 4, [23, 'yyyy'], [234, [555]]]]
if __name__ == "__main__":... | Nikolay-Zavrazhnov/Iterators_and_generators | main.py | main.py | py | 899 | python | en | code | 0 | github-code | 36 |
533976729 | print("ASSIGNMENT-3\nNAME-SUNPREET SINGH\nSID-21103118\n\n")
# QUESTION 1
print("Question 1\n")
a=str(input("Enter A String: "))
list=a.split()
dict={}
if list.__len__()==1:
for i in list[0]:
if i in dict:
dict[i]+=1
else:
dict[i]=1
print(dict)
else: ... | GevaterTod/PYTHONASSIGNMENTS | assignment3_21103118_cse.py | assignment3_21103118_cse.py | py | 6,367 | python | en | code | 0 | github-code | 36 |
9875076956 |
from typing import List
def add_border(picture: List[str]) -> List[str]:
longest = len(max(picture, key=len))
unframed = [
'* ' + s + f"{' ' * (longest - (len(s)-1))}*"
if len(s) < longest
else f"* {s} *"
for s in picture
]
edge = '*' * (longest + 4)
pad = f"*{'... | barkdoll/100-algo | addBorder/add_border.py | add_border.py | py | 687 | python | en | code | 0 | github-code | 36 |
2723187503 | class subarraysum_prefix:
def checkSubarraySum(self, nums: List[int], k: int) -> bool:
# special case 当前n个就是和是6的时候,sum1 存储的是0:-1
# key: presum, value: index
#
d = {0:-1}
prefix = nums[::]
for i in range(1, len(prefix)):
prefix[i] = prefix[i] + prefix[i-1]
... | ZhengLiangliang1996/Leetcode_ML_Daily | template/twoSum.py | twoSum.py | py | 949 | python | en | code | 1 | github-code | 36 |
8754931365 | # -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, fields, api
from odoo.exceptions import ValidationError
from of_datastore_product import DATASTORE_IND
class OfProductBrand(models.Model):
_inherit = 'of.product.brand'
datastore_supplier_id = f... | odof/openfire | of_datastore_product/models/of_product_brand.py | of_product_brand.py | py | 17,449 | python | fr | code | 3 | github-code | 36 |
73261015785 | import os,sys
current_directory = os.path.dirname(os.path.realpath(__file__))
parent_directory = os.path.dirname(current_directory)
sys.path.append(parent_directory)
import numpy as np
from Models_pred.FFN import FFN
from sklearn.model_selection import train_test_split
import time
from channel import Channel
from dat... | hadifawaz1999/dnn-4-of | main_files/main_predictors.py | main_predictors.py | py | 2,359 | python | en | code | 1 | github-code | 36 |
6700008015 | import tensorflow as tf
def int64_feature(values):
"""Returns a TF-Feature of int64s.
Args:
values: A scalar or list of values.
Returns:
A TF-Feature.
"""
if not isinstance(values, (tuple, list)):
values = [values]
return tf.train.Feature(int64_list=tf.train.Int64List(val... | h3nok/MLIntro | Notebooks/core/dataset/feature.py | feature.py | py | 1,581 | python | en | code | 0 | github-code | 36 |
71170295463 | import datetime
import re
from django import forms
from django.contrib.auth.forms import (
UserCreationForm,
AuthenticationForm,
PasswordChangeForm,
PasswordResetForm,
SetPasswordForm,
)
from app.models import Person, User, Information, Competition
from django.conf import settings
from django.core.m... | speedcubing-japan/scj | python/src/app/forms.py | forms.py | py | 17,948 | python | en | code | 5 | github-code | 36 |
2719854593 |
#Base on ICRS of IERS,
#input:a,e,i,Omega, omega,E output:
from numpy import mat,cos,sin,array
from math import radians,sqrt
# import numpy as np
#
# class MyOrbit:
# def __init__(self, a):
# self.local_var_init(a)
# self.var_a = a
#
# def local_var_init(self, a):
# if 2<a<5:
# ... | XinruiLiuUA/vlbiOrbitSimulation | OrbitElementsToRV.py | OrbitElementsToRV.py | py | 2,084 | python | en | code | 0 | github-code | 36 |
69955469226 | from setuptools import setup
from pybind11.setup_helpers import Pybind11Extension, build_ext
ext_modules = [
Pybind11Extension(
"harmonica/bindings",
[
'harmonica/orbit/kepler.cpp',
'harmonica/orbit/trajectories.cpp',
'harmonica/orbit/gradients.cpp',
... | DavoGrant/harmonica | setup.py | setup.py | py | 1,523 | python | en | code | 6 | github-code | 36 |
10713087368 | import matplotlib.pyplot as plt
import numpy as np
from learn_seq.controller.base import TaskController
from learn_seq.utils.general import saturate_vector
from learn_seq.utils.mujoco import quat2vec, quat_error
class HybridController(TaskController):
"""Simulated parallel hybrid force/position controller, where... | deanpham98/learn-seq | learn_seq/controller/hybrid.py | hybrid.py | py | 6,567 | python | en | code | 3 | github-code | 36 |
10309070734 | from configparser import ConfigParser
from multiprocessing import Pool
import os
import sys
if len(sys.argv) != 2:
print('Arguments: config')
sys.exit(-1)
cp = ConfigParser()
with open(sys.argv[1]) as fh:
cp.read_file(fh)
cp = cp['config']
nb_classes = int(cp['nb_classes'])
dataset = cp['dataset']
random_... | GregoirePetit/FeTrIL | codes/prepare_train.py | prepare_train.py | py | 1,440 | python | en | code | 35 | github-code | 36 |
37227731421 | from easygui import *
import re, client, tcp_pickle, random, streamplay, Cuser
def login_procedure():
while True:
msg = "Введите логин и пароль"
title = "Авторизация"
fieldNames = ["Логин", "Пароль"]
fieldValues = multpasswordbox(msg, title, fieldNames) # отображения окон
... | cruckens/drm_app | gui.py | gui.py | py | 6,031 | python | ru | code | 0 | github-code | 36 |
34377423467 | import os
import pytest
import numpy as np
from pynpoint.core.pypeline import Pypeline
from pynpoint.readwrite.fitsreading import FitsReadingModule
from pynpoint.processing.frameselection import RemoveFramesModule, FrameSelectionModule, \
RemoveLastFrameModule, RemoveSta... | PynPoint/PynPoint | tests/test_processing/test_frameselection.py | test_frameselection.py | py | 15,896 | python | en | code | 17 | github-code | 36 |
3581458900 | # Import necessary libraries
import openai
import sys
import json
import html
import re
import ssl
import os
import pprint
import nltk
import requests
import time
if not nltk.data.find('tokenizers/punkt'):
nltk.download('punkt', quiet=True)
# Get the first command line argument
location = sys.argv[1]
sku = sys.a... | menached/ai_product_updater | fetch-first-push-to-rest.py | fetch-first-push-to-rest.py | py | 8,235 | python | en | code | 0 | github-code | 36 |
37288735237 | import os
import cv2
import numpy as np
from keras.models import load_model
from keras.utils import to_categorical
# Define the path to the FER-2013 test dataset directory
test_data_path = "/content/Dissertation-Project/dataset/test"
# Define the list of emotions and their corresponding labels
emotion_labels = {
... | alex-nazemi/Dissertation-Project | test_model.py | test_model.py | py | 1,831 | python | en | code | 0 | github-code | 36 |
41747499008 | #!/usr/bin/python3
"""
Executes storage when module is called
"""
from models.engine import file_storage
from models.base_model import BaseModel
from models.user import User
from models.review import Review
from models.place import Place
from models.city import City
from models.amenity import Amenity
from models.state ... | adrielt07/Docker-Introduction | AirBnB_clone_v1/models/__init__.py | __init__.py | py | 1,223 | python | en | code | 1 | github-code | 36 |
8844317309 | import signal
import time
import sys
from typing import *
from multiprocessing import Process, Pipe, Value
from multiprocessing.connection import Connection
from threading import Thread
import zmq
import pyaudio
import numpy as np
from config import sr, input_dim, dtw_k, dtw_cost, channels
from transformer import mfc... | d32f123/master-thesis | python/twitrecog.py | twitrecog.py | py | 6,471 | python | en | code | 0 | github-code | 36 |
15450209554 | import requests
from bs4 import BeautifulSoup
from time import sleep
movie_links_id = []
for z in range(10):
print(z)
url_1 = f"https://www.kinoafisha.info/rating/movies/?page={z}"
sleep(5)
r_1 = requests.get(url_1, timeout=5)
soup_1 = BeautifulSoup(r_1.text, 'lxml')
films = soup_1.find_all(... | VitOsGG/parser_movie | pars_movie_id.py | pars_movie_id.py | py | 525 | python | en | code | 0 | github-code | 36 |
72183873063 |
class Account:
def __init__(self, name, balance):
self._name = name
self.__balance = balance
self.show_balance()
def deposit(self, amount):
if amount > 0:
self.__balance += amount
print("Aomunt deposited")
self.show_balance()
def withd... | agarwalanant/PythonPractice | OOPs1.py | OOPs1.py | py | 717 | python | en | code | 0 | github-code | 36 |
6354103767 | fd = open('Day3.txt', 'r')
def priority(prod):
offset = 27 - ord('A') if prod.isupper() else 1 - ord('a')
return ord(prod) + offset
# Day3_1
# total = 0
# for line in fd:
# line = line.strip()
# mid = len(line)//2
# sym_left, sym_right = set(line[:mid]), set(line[mid:])
# total += priority((s... | LevTG/advent2022 | Day3.py | Day3.py | py | 590 | python | en | code | 0 | github-code | 36 |
29273051628 | import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import numpy as np
import os
from collections import deque
from src.game_env import *
from src.ppo import *
import src.utils as utils
is_cuda = torch.cuda.is_available()
# device = 'cuda' if is_cuda else 'cpu'
device = '... | ray075hl/PPO_super_mario | src/agent.py | agent.py | py | 8,651 | python | en | code | 5 | github-code | 36 |
7260068707 |
# If input is not valid letter, show message that prompts user to put in a valid letter
import random
with open('words.txt') as words:
lines = words.readlines()
lines = [line.lower().replace('\n', '') for line in lines]
easy_words = [line for line in lines if 4 <= len(line) <= 6]
normal_words = [lin... | Momentum-Team-9/py--mystery-word-andreavaughan | game.py | game.py | py | 3,837 | python | en | code | 0 | github-code | 36 |
5975577569 | #!/usr/bin/env python2
# -*- encoding:utf-8 -*-
"""
Polyshaper svg paths extraction tests
NOTE: to run this test standalone you must add ../plugin to the PYTHONPATH shell
variable tro to sys.path as well as the global inkscape plugin directory. If run
through testAll.py, there is no need to add directories (they are ... | guiEmotiv/PolyShaper_inkscape | polyshaper/test/test_polyshaper/test_pathsextraction.py | test_pathsextraction.py | py | 17,466 | python | en | code | 0 | github-code | 36 |
34677552243 | import logging
import numpy as np
from ComperfModelling import predict_from_model
def run_kernel_density_estimation(values, normalised=False, normalisation_statistic=0):
values = values.reshape(-1,1)
# What should bandwidth be? Add as part of experiment configuration?
bandwidth = 100000
evaluation_gap = 50000
... | Richard549/ComPerf | src/ComperfAnalysis.py | ComperfAnalysis.py | py | 28,464 | python | en | code | 0 | github-code | 36 |
70585509224 | import numpy as np
import torch
from collections import deque
from motion_pred.utils.config import Config
from models.motion_pred import *
import pickle
from datetime import datetime
import os
import time
index = 0
class HumanLatent:
def __init__(self, date_time=None):
self.device = torch.de... | yichen928/RSR_Goalkeeper | src/human_latent/src/human_latent.py | human_latent.py | py | 5,285 | python | en | code | 0 | github-code | 36 |
37918714311 | from django.http import Http404, HttpResponseRedirect
from django.shortcuts import render_to_response, get_object_or_404
from models import Meuble, CommandeParticulier, CommandeProfessionnel
from forms import MeubleQuantiteListForm, ParticulierContactForm, MeubleQuantiteFormSet, ProfessionnelContactForm
from django.tem... | austing/Hakim | hakim/moving/views.py | views.py | py | 3,298 | python | en | code | 0 | github-code | 36 |
15296957499 | #!/usr/bin/env python3
import os
import pickle
import warnings
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from scipy.stats import norm
import ROOT
import uproot
import yaml
SPEED_OF_LIGHT = 2.99792458
SPLIT = True
centrality_colors = [ROOT.kOrange+7, ROOT.kAzure+4, ROOT.kTeal+4, ROOT.kBla... | maciacco/MuBFromRatios_PbPb | Hypertriton_PbPb/ratio.py | ratio.py | py | 11,027 | python | en | code | 0 | github-code | 36 |
12214621000 | import io
import sys
_INPUT = """\
4 4
1 2
1 3
1 4
3 4
1 3
1 4
2 3
3 4
"""
sys.stdin = io.StringIO(_INPUT)
# 本番コードはこのコメント以下に書く、import,def,も
n,m=map(int, input().split()) #複数数値入力 「A B」みたいなスペース空いた入力のとき
graph_taka = [[] for _ in range(n)]
for _ in range(m):
a, b = map(int, input().split())
graph_taka[a-1].app... | MasayaKondo999/rent | ABC232/1219_3.py | 1219_3.py | py | 876 | python | en | code | 0 | github-code | 36 |
40063496981 | from django.urls import include, path
from rest_framework import routers
from api.views import BasketModelAPIViewSet, ProductModelAPIViewSet
app_name = 'api'
router = routers.DefaultRouter()
router.register(r'products', ProductModelAPIViewSet)
router.register(r'baskets', BasketModelAPIViewSet)
urlpatterns = [
p... | Bereznikov/Online-shop | store/api/urls.py | urls.py | py | 353 | python | en | code | 0 | github-code | 36 |
21892466278 | from pathlib import Path
from git import Repo
GENERATION_DICT = dict(example_mouse=[100])
cwd = Path.home() / "bg_auto"
cwd.mkdir(exist_ok=True)
if __name__ == "__main__":
repo_path = cwd / "atlas_repo"
atlas_gen_path = Path(__file__).parent
repo = Repo(repo_path)
# repo.git.add(".")
# repo.... | brainglobe/bg-atlasgen | bg_atlasgen/test_git.py | test_git.py | py | 427 | python | en | code | 7 | github-code | 36 |
21282164526 | # import json
# import requests
from Logging_Conversation import LoggingConversation
# import os
# from dotenv import load_dotenv
#######################################################################################################################
####### Executing Logic
#################################... | syedfaziz/DemoCovidEntireChatbot | User_Entering_Name_Yes.py | User_Entering_Name_Yes.py | py | 1,014 | python | en | code | 0 | github-code | 36 |
8446735468 | import os
import platform
import tempfile
import urllib
from cupy import testing
from cupyx.tools import install_library
import pytest
_libraries = ['cudnn', 'nccl', 'cutensor']
def _get_supported_cuda_versions(lib):
return sorted(set([
rec['cuda'] for rec in install_library.library_records[lib]]))
... | cupy/cupy | tests/cupyx_tests/tools_tests/test_install_library.py | test_install_library.py | py | 2,663 | python | en | code | 7,341 | github-code | 36 |
4108107097 | import sys
input = lambda: sys.stdin.readline()[:-1]
n, q = [int(x) for x in input().split()]
items = {input() for _ in range(n)}
counter = 0
for _ in range(q):
done = 1
for _ in range(int(input())):
if input() not in items:
done = 0
if done:
counter += 1
print(counter)
| AAZZAZRON/DMOJ-Solutions | dmopc19c5p1.py | dmopc19c5p1.py | py | 313 | python | en | code | 1 | github-code | 36 |
2678119145 | def solve(a, b, c, x):
q = x // (a + c)
r = x % (a + c)
return (q * a + min(a, r)) * b
a, b, c, d, e, f, x = map(int, input().split())
takahashi = solve(a, b, c, x)
aoki = solve(d, e, f, x)
if takahashi > aoki:
print("Takahashi")
elif takahashi < aoki:
print("Aoki")
else:
print("Draw")
| Tako64tako/competitive-programming | 249/a.py | a.py | py | 303 | python | en | code | 2 | github-code | 36 |
7774259589 | class Tree():
def __init__(self, data):
self.data = data
self.child = []
m = int(input())
ip = list(map(int, input().split()))
l = []
root = None
for i in ip:
if(i==-1):
l.pop()
else:
node = Tree(i)
if(len(l)==0):
root = node
else:
l[-1].child.append(node)
l.append(no... | nishu959/Generictreepepcoding | heightofgenerictree.py | heightofgenerictree.py | py | 483 | python | en | code | 0 | github-code | 36 |
5272933493 | from resources.libraries.python.VatExecutor import VatTerminal, VatExecutor
class NATUtil(object):
"""This class defines the methods to set NAT."""
def __init__(self):
pass
@staticmethod
def set_nat44_interfaces(node, int_in, int_out):
"""Set inside and outside interfaces for NAT44.
... | ondrej-fabry/csit | resources/libraries/python/NATUtil.py | NATUtil.py | py | 8,244 | python | en | code | null | github-code | 36 |
11722208594 | # function2py
#전역변수와 지역변수
x=1
def func(a):
return a+x
#호출
print(func(1))
def func2(a):
x = 2
return a+x
print(func2(1))
def times(a=10, b=20):
return a*b
print(times())
print(times(5))
print(times(5,6))
def connectURI(server, port):
strURL = "http://"+ server+ ":" + port
return strURL
p... | swinugit/python220418 | function2py.py | function2py.py | py | 651 | python | en | code | 0 | github-code | 36 |
15673441989 | import requests
from web.models import ApiKeys
def __search(params):
api_key = ''
for keys in ApiKeys.select():
api_key = keys.key
s = requests.session()
s.headers = {
"Authorization": "Bearer " + api_key
}
r = s.get("https://api.yelp.com/v3/businesses/s... | 360cloudhub/Let-s-kick-it | yelp.py | yelp.py | py | 1,828 | python | en | code | 0 | github-code | 36 |
26370756827 | import rospy
from trac_ik_python.trac_ik import IK
rospy.init_node('test_script')
# Get your URDF from somewhere
with open('/home/mlei/concert_ws/ros_src/modularbot/urdf/ModularBot.urdf', 'r') as file:
urdf=file.read()
ik_solver = IK("base_link",
"ee_A", urdf_string=urdf)
lower_bound, upper_boun... | MaolinLei/OnlineVerfication | concert_examples/ik.py | ik.py | py | 693 | python | en | code | 0 | github-code | 36 |
17090297176 | # ROZCVICKA
# spravime si prazdny dict.
slovnik = dict()
def pridaj_slovicko(slovnik: dict) -> dict:
'''
'''
# 1 budeme pridavat klucove slovo
kluc = input('ZADAJ KLUC')
# 2hodnotu v podobe string
if kluc == 'q':
print('KONIEC')
quit()
hodnota = input('ZADAJ STRING')
#... | fortisauris/PyDevJunior2 | session10-01_Pridaj_Slovicka.py | session10-01_Pridaj_Slovicka.py | py | 648 | python | sl | code | 1 | github-code | 36 |
17849210832 | import torch
import torch.nn as nn
from prodict import Prodict
import utils
class Reducer(nn.Module):
def __init__(self, dims: Prodict, device=torch.device("cpu")):
super(Reducer, self).__init__()
self.input_dim = dims.INPUT_DIM
self.output_dim = dims.OUTPUT_DIM
self.net = nn.Seque... | jameslu01/TDNODE | src/model/SLD/reducer.py | reducer.py | py | 682 | python | en | code | 0 | github-code | 36 |
36773748033 | from bs4 import BeautifulSoup
import requests
import pymongo
from splinter import Browser
from splinter.exceptions import ElementDoesNotExist
import tweepy
# from config import (consumer_key,
# consumer_secret,
# access_token,
# access_token_secret)
# auth = ... | Jagogbua13/Web-scraping | Web-Scrape HW/scrape_mars.py | scrape_mars.py | py | 4,126 | python | en | code | 0 | github-code | 36 |
19250829785 | from __future__ import absolute_import, division, print_function
import os
import io
import sys
import glob
import base64
import json
import argparse
from tqdm import tqdm
import numpy as np
from PIL import Image
sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__))))
from utils.equi_to_cube imp... | swhan0329/panorama_image_inpainting | pre_proc/create_data.py | create_data.py | py | 3,581 | python | en | code | 17 | github-code | 36 |
2911796694 | from tqdm import tqdm
import torch
import torchvision
import torchvision.transforms as transforms
import pandas as pd
import numpy as np
from torch.utils.data import Dataset, DataLoader, Subset
from model import dCNN
from dataset import NumpySBDDataset
import torch.optim as optim
import os
import yaml
import argparse
... | arunsanknar/AlectioExamples | urban-sound-classification/process.py | process.py | py | 9,819 | python | en | code | 0 | github-code | 36 |
73087531943 | # -*- coding: utf-8 -*-
# @Author: Ahmed kammorah
# @Date: 2019-04-14 22:19:20
# @Last Modified by: Ahmed kammorah
# @Last Modified time: 2019-04-14 23:11:39
from http.server import BaseHTTPRequestHandler, HTTPServer
import json
import re
import socket
from threading import Thread
import requests
MOCK_SERVER_PORT ... | AhmedKammorah/AKEmailService | MainService/tests/ak_mock_server.py | ak_mock_server.py | py | 1,133 | python | en | code | 0 | github-code | 36 |
30370862143 | import sys
sys.stdin = open('input.txt')
def BFS(row1, col1):
to_visits = [[row1, col1]]
global answer
global flag
dxs = [1, 0, -1, 0]
dys = [0, 1, 0, -1]
while to_visits:
current = to_visits.pop(0)
current_row = current[0]
current_col = current[1]
visited[curren... | pugcute/TIL | algorithm/21736_헌내기는 친구가 필요해/21736.py | 21736.py | py | 1,141 | python | en | code | 0 | github-code | 36 |
993420562 | #!/usr/bin/env python
# -*- Python -*-
# -*- coding: utf-8 -*-
# ------------------------------------------------- #
# Python source single (add-dir-to-vim-projects.py) #
# Author: Alexei Panov <me@elemc.name> #
# ------------------------------------------------- #
# Description:
import os
import os.path... | elemc/scripts | python/add-dir-to-vim-projects.py | add-dir-to-vim-projects.py | py | 1,738 | python | en | code | 1 | github-code | 36 |
74298320102 | #!/usr/bin/env python
#encoding=utf8
class Record():
def __init__(self, record_id, parent_id):
self.record_id = record_id
self.parent_id = parent_id
class Node():
def __init__(self, node_id):
self.node_id = node_id
self.children = []
def check_node_id(self):
if a... | xiaket/exercism | python/tree-building/tree_building.py | tree_building.py | py | 2,023 | python | en | code | 0 | github-code | 36 |
73325034344 | from selenium import webdriver
from selenium.webdriver import Chrome
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys
chrome_options = O... | LucasPeresFaria/qa_eduzz | selenium_qa/qa_teste.py | qa_teste.py | py | 1,045 | python | pt | code | 0 | github-code | 36 |
2316650398 | import os
def sort_file(source_path, dest_path):
global_content = []
for file_ in os.listdir(source_path):
#read the file for contents
with open(source_path +file_, "r") as f:
for line in f.readlines():
# print(line)
line = line.strip()
... | cholarajaa/sort-by-filecontent-by-time | test.py | test.py | py | 872 | python | en | code | 0 | github-code | 36 |
43729251600 | from torch import nn
class Convolution(nn.Module):
def __init__(self, in_channels, out_channels, k_size=3, rate=1):
super().__init__()
self.convlayer = nn.Sequential(
nn.Conv2d(in_channels=int(in_channels),
out_channels=int(out_channels),
ker... | mrFahrenhiet/CrackSegmentationDeepLearning | model/convolutionBase.py | convolutionBase.py | py | 573 | python | en | code | 24 | github-code | 36 |
8882862385 | import numpy as np
from collections import defaultdict
import rl.env
import rl.player
import rl.display
class Env(rl.env.DiscreteEnv):
def __init__(self, n = 10, h = 1, p = 2, k = 3) -> None:
super().__init__()
self.n = n
self.h = h
self.p = p
self.k = k
... | TheGoldenChicken/robust-rl | ware_house/ware_house.py | ware_house.py | py | 5,829 | python | en | code | 0 | github-code | 36 |
73509508903 | from utils import *
click.echo("Entering level 2")
click.pause()
coffee_counter.count = 0
screen(office, [
"It is the day of your thesis submission",
"You have 3 hours before you need to submit",
"But there is a problem",
"You have lost your only copy!"
])
click.pause()
response = None
wt = 2.0
whi... | azimov/the_game | nicole.py | nicole.py | py | 2,722 | python | en | code | 0 | github-code | 36 |
25305939157 | __author__ = 'diegopinheiro'
from genetic_algorithms.genetic_algorithm import GeneticAlgorithm
from stop_criterions.iteration import IterationStopCriterion
from common.set_reader import SetReader
from selection_strategies.fitness_proportionate import FitnessProportionate
from selection_strategies.tournament_selection... | diegompin/genetic_algorithm | experiments/test_iris.py | test_iris.py | py | 5,058 | python | en | code | 1 | github-code | 36 |
1306958891 | #Create a contact book
contact_book = {
"John": {
"Full Name": "John Henry",
"Phone": ["123", "456"],
"Email": ["john@gmail.com", "john.work@live.com"],
"Address": "Hanoi",
"Note": "This is John",
"Tag": ["friend", 'work']
},
"Rossa": {
"Phone": ["321... | tholuongduc/mypython3 | Dictionary/Contact_book.py | Contact_book.py | py | 4,879 | python | en | code | 0 | github-code | 36 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.