id stringlengths 2 8 | text stringlengths 16 264k | dataset_id stringclasses 1
value |
|---|---|---|
11225673 | #!/usr/bin/env python3
from __future__ import print_function
import errno
import sys
import logging
from pyocd.core.helpers import ConnectHelper
from pyocd.flash.file_programmer import FileProgrammer
from pyocd.flash.eraser import FlashEraser
from binho.utils import log_silent, log_verbose
from binho.errors import D... | StarcoderdataPython |
35582 | #!/usr/bin/python
import sys
import csv
def split_num(n, M):
# n : original number
# M : max size for split range
nsplit = n//M
if nsplit*M < n:
nsplit += 1
ninterval = n//nsplit
ncum = 1
end = 0
res = []
while end < n:
start = ncum
ncum += ninterval
... | StarcoderdataPython |
1971833 | import re
from contextlib import suppress
from queue import Empty, PriorityQueue, Queue
from sys import maxsize
from threading import Thread
from time import time_ns
from .config import cfg
from .graphics import Image, ImageDraw, ImageOps, blur, encode
from .vocab_pick import Set
CANVAS_SZ = (cfg['image-max-width'], ... | StarcoderdataPython |
376111 | from grin import get_grin_arg_parser
from genzshcomp import CompletionGenerator
if __name__ == '__main__':
generator = CompletionGenerator("grin", get_grin_arg_parser())
print generator.get()
| StarcoderdataPython |
4951274 | import numpy as np
import theano
import theano.tensor as T
from collections import OrderedDict
a = theano.shared(np.zeros((1, 1), dtype = theano.config.floatX))
b = theano.shared(np.zeros((1, 1), dtype = theano.config.floatX))
c = T.scalar()
updates = OrderedDict()
updates[a] = a + 1
updates[b] = b + a
f = theano.func... | StarcoderdataPython |
305504 | <reponame>danmohad/PMC-thermodynamics
# -*- coding: utf-8 -*-
"""
Porous Media Combustor (PMC) Class
Copyright 2020, <NAME>, All rights reserved.
Refer to <NAME>, <NAME>, <NAME>, "Thermodynamic cycle analysis of superadiabatic matrix-stabilized combustion for gas turbine engines," Energy (207) 2020.
"""
imp... | StarcoderdataPython |
3221875 | from rest_framework import viewsets
from score.models import Album, Score
from score.serializers import AlbumSerializer, ScoreSerializer
class AlbumViewset(viewsets.ModelViewSet):
queryset = Album.objects.all()
serializer_class = AlbumSerializer
class ScoreViewset(viewsets.ModelViewSet):
queryset = Scor... | StarcoderdataPython |
5131710 | <reponame>japonophile/darwin
from ikpy.chain import Chain
from ikpy.URDF_utils import get_chain_from_joints
from urdfpy import URDF
import math
import sys
def ang(offset_deg):
abs_deg = 150 + offset_deg
abs_rad = math.pi * abs_deg / 180
return abs_rad
DARWIN_URDF = 'darwin.urdf'
robot = URDF.load(DARWIN... | StarcoderdataPython |
6425652 | <gh_stars>100-1000
import unittest
from uvm.reg.uvm_reg_predictor import UVMRegPredictor, UVMPredictS
from uvm.uvm_unit import (create_reg, create_reg_block, TestPacket,
TestRegAdapter)
class TestUVMRegPredictor(unittest.TestCase):
def test_create_predictor(self):
predict = UVMRegPredictor("predic... | StarcoderdataPython |
3520958 | <reponame>timgianitsos/ancient_greek_genre_classification
import greek_features #seemingly unused here, but this makes the environment recognize features
import extract_features
from corpus_categories import composite_files, verse_misc_files, prose_files
import os
import sys
if __name__ == '__main__':
#Download corp... | StarcoderdataPython |
8013554 | <filename>deploy/raw_test.py
from flask import Flask,abort,request,jsonify
app = Flask(__name__)
@app.route('/',methods=['GET','POST'])
def home():
return '<h>RedHouse Project</h>'
@app.route('/add_tast/',methods=['POST'])
def add_task():
print('###############',123123123123)
print(request.json)
r... | StarcoderdataPython |
9695948 | <reponame>sarang-apps/darshan_browser
#!/usr/bin/env vpython
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import json
import os
import shutil
import tempfile
import unittest
from core import path_util
... | StarcoderdataPython |
6483659 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2018 by <NAME>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
#... | StarcoderdataPython |
5075902 | <gh_stars>0
import unittest
import os
from load_configuration import *
import shutil
import copy
def test_generateConfig(self):
generateConfig()
parser = configparser.ConfigParser()
parser.read(config_address)
self.assertEqual(dict(parser['general']), defaults)
def test_updateValue(self, key, value):
... | StarcoderdataPython |
3379417 |
import math
blockStart=[0,0]
def addBlock(x,y):
global blockStart
blocks.append({"x1":blockStart[0], "y1":blockStart[1], "x2":x, "y2":y, "exitVelX":0, "exitVelY":0, "accX":0, "accY":0, "blkTime":0})
blockStart = [x,y]
def bisector(p1, p2):
x1, y1 = p1
x2, y2 = p2
if (y1 == y2):
return... | StarcoderdataPython |
8142533 | <reponame>carlosep93/LANGSPEC
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This ref code is licensed under the license found in the LICENSE file in
# the root directory of this ref tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import ite... | StarcoderdataPython |
3564117 | import numpy as np
import cv2
import matplotlib.pyplot as plt
import tensorflow as tf
from number import Number
from all_numbers_video import All_numbers
import linija as linija
# keras
from keras.models import Sequential
from keras.layers import Dense, Conv2D, Dropout, Flatten, MaxPooling2D
import test as testiranje
... | StarcoderdataPython |
3563042 | <reponame>rheinonen/hw_ml
import numpy as np
import xgboost as xgb
import sklearn as skl
import time
from matplotlib import pyplot as plt
#from keras.models import Sequential
#from keras.layers import Dense
from keras.models import load_model
#from keras import regularizers
#from keras.callbacks import EarlyStopping, M... | StarcoderdataPython |
1788792 | #!/usr/bin/env python3
import json as jsonlib
import requests
import os
import hashlib
import argparse
# SOURCE: https://github.com/AdrianKoshka/flatpak-tools/blob/master/org.mozilla.Thunderbird/genman.py
# Setup arguments to be parsed
parser = argparse.ArgumentParser(description="Auto generates ScarlettOS' flatpak ... | StarcoderdataPython |
3527353 | <gh_stars>0
#!/usr/bin/env python
# coding: utf-8
import meshio
import pygmsh
import numpy as np
import copy
import glob
from collections import Counter
import os
import json
import shutil
import scipy.optimize as opt
from EnergyMinimization import *
import numba
# which line of input file defines me?
line=int(sys.argv... | StarcoderdataPython |
6557526 | <filename>ode/adams_moulton_method.py<gh_stars>0
'''
Implements Adams-Moulton Method
'''
| StarcoderdataPython |
8142625 | from letter_state import LetterState
class Pardle:
MAX_ATTEMPTS = 6
WORD_LENGTH = 5
def __init__(self, secret: str):
self.secret: str = secret.upper()
self.attempts = []
def attempt(self, word: str):
word = word.upper()
self.attempts.append(word)
def guess(self, ... | StarcoderdataPython |
4845327 | import re
from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
from scrapy.http import Request, FormRequest
from scrapy.utils.response import get_base_url
from scrapy.utils.url import urljoin_rfc
from productloader import load_product
from scrapy.http import FormRequest
from pr... | StarcoderdataPython |
8087514 | from ceci.main import run
from parsl import clear
import tempfile
import os
import pytest
import subprocess
from ceci.pipeline import Pipeline
from ceci_example.example_stages import *
from ceci.config import StageConfig
def test_config():
config_options = {'chunk_rows': 5000, 'something':float, 'free':None}
... | StarcoderdataPython |
3349483 | import jax.numpy as jnp
from rA9.networks.module import Module
from .img2col import *
from .LIF_recall import *
class pool2d(Module):
def __init__(self, input, kernel_size, stride, tau, vth, dt, v_current):
super(pool2d, self).__init__()
self.input = input
self.kernel_size = kernel_size
... | StarcoderdataPython |
11366725 | from hetdesrun.component.registration import register
from hetdesrun.datatypes import DataType
def volatility(series, freq, stamped="right"):
"""A simple volatility measurement
Tries to measure volatility in a time series. Works by comparing sum of absolute
differences to the absolute value of the su... | StarcoderdataPython |
6590402 | # --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import os... | StarcoderdataPython |
394118 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | StarcoderdataPython |
8151279 | <filename>sols/1189.py
import collections
from collections import Counter
class Solution:
# Counter + Int Div (Accepted), O(n) time and space
def maxNumberOfBalloons(self, text: str) -> int:
txt_c, bal_c = Counter(text), Counter('balloon')
return min(txt_c[c] // bal_c[c] for c in bal_c)
#... | StarcoderdataPython |
3534356 | #!/usr/bin/env python
#
# Copyright 2012,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your optio... | StarcoderdataPython |
4996087 | <filename>src/utils.py
# -*- coding: utf-8 -*-
"""
Utils of the game.
@Author: yanyongyu
"""
__author__ = "yanyongyu"
def getHitmask(image):
"""returns a hitmask using an image's alpha."""
mask = []
for x in range(image.get_width()):
mask.append([])
for y in range(image.get_height()):
... | StarcoderdataPython |
8152417 | <reponame>jna29/SymGP<gh_stars>1-10
import sys
# Add the symgp folder path to the sys.path list
module_path = r'/Users/jaduol/Documents/Uni (original)/Part II/IIB/MEng Project/'
if module_path not in sys.path:
sys.path.append(module_path)
from symgp import SuperMatSymbol, utils, MVG, Variable, SuperDiagMat, Kernel... | StarcoderdataPython |
3392616 | <filename>django_blog_comments/models.py
from django.db import models
from django.contrib.auth.models import User
from django.conf import settings
# Create your models here.
class Comments(models.Model):
sno = models.AutoField(primary_key=True)
comment_text = models.TextField()
user = models.ForeignKey(Us... | StarcoderdataPython |
8080757 | <reponame>BorisYourich/EurOPDX-Galaxy
#! /usr/bin/env python
from __future__ import print_function
"""
RSEM Alignment to transcriptome.
Version: 1.3.0
"""
import sys
import os
import shutil
import argparse
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('--seed-length', '--seed-lengt... | StarcoderdataPython |
11346208 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import torch
import torch.nn as nn
import torch.utils.model_zoo as model_zoo
import math
BN_MOMENTUM = 0.01
model_urls = {
'mobilenet_v2': 'https://download.pytorch.org/models/mobil... | StarcoderdataPython |
9632140 | <reponame>npurcella/rtwo<gh_stars>1-10
"""
Create a mock driver and attempt to call each mock method that RTwo adds data
to!
"""
import unittest
from mock import Mock, patch
from rtwo.test.secrets import OPENSTACK_PARAMS
from libcloud.utils.py3 import httplib
from libcloud.utils.py3 import method_type
from libcloud.... | StarcoderdataPython |
3592 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from config import CONFIG
import json
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt # pylint: disable=g-import-not-at-top
import io
import math
import os
import time
from absl i... | StarcoderdataPython |
11212793 | <gh_stars>0
from .menus import *
from .misc import Loading
from .paginators import BasePaginator
| StarcoderdataPython |
1670606 | import pygame
from .chars import Enemy
from .shells import *
import os
# Working file paths
BASE_PATH = os.path.dirname(__file__)
IMAGES_PATH = os.path.join(BASE_PATH, 'resources/Images/')
# virus_1
class Virus1(Enemy):
ammo = Virus1shell
height = 78
width = 78
hp = 100
health_max = 100
# Virus... | StarcoderdataPython |
16094 | if __name__ == '__main__':
from .system import MyApp
MyApp().run()
| StarcoderdataPython |
6569743 | def test_if_template_json_loads_successfully():
from metadata.v140.template import OEMETADATA_V140_TEMPLATE
def test_template_against_schema_which_should_succeed():
import jsonschema
from metadata.v140.template import OEMETADATA_V140_TEMPLATE
from metadata.v140.schema import OEMETADATA_V140_SCHEMA
... | StarcoderdataPython |
1661560 | """
Simple custom commands to send preconfigured text messages to channels.
Config:
commands ((str, str) dict):
Mapping from command name to rich response text.
"""
import immp
from immp.hook.command import command, DynamicCommands
class TextCommandHook(immp.Hook, DynamicCommands):
"""
Command p... | StarcoderdataPython |
5061921 | <filename>flask-api/service/movie.py
from app import db
from exception.movie_exists import MovieExists
from exception.resource_not_found import ResourceNotFound
from model.genre import Genre
from model.movie import Movie
from model.rating import Rating
from model.role import Role
from model.user import User
from schema... | StarcoderdataPython |
6522674 | # -*- coding: utf-8 -*-
#
# Copyright (c) 2018 <NAME> (Kronuz)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, m... | StarcoderdataPython |
8058828 |
# count = int(input())
# for _ in range(count):
# a, b = map(int, input().split())
# print (a+b)
''' [Question 8393] John got a bad mark in math. The teacher gave him another task. John is to write a program which computes the sum of integers from 1 to n. If he manages to present a correct program, the b... | StarcoderdataPython |
6635653 | """
Pure python implementation of rtree
Modification of
http://code.google.com/p/pyrtree/
"""
__all__ = ['RTree', 'Rect', 'Rtree', 'RTreeError']
MAXCHILDREN = 10
MAX_KMEANS = 5
BUFFER = 0.0000001
import math
import random
import time
import array
class RTreeError(Exception): pass
class Rect(object):
"""
A... | StarcoderdataPython |
8103300 | import keras
import cv2
import numpy as np
import argparse
from glob import glob
# GPU config
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
import tensorflow as tf
from keras import backend as K
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
config.gpu_options.visible_device_list="0"
sess = tf.S... | StarcoderdataPython |
12852228 | <reponame>MichelangeloConserva/Colosseum<filename>colosseum/mdps/river_swim/episodic/mdp.py
import gin
from colosseum.loops import human_loop
from colosseum.mdps import EpisodicMDP
from colosseum.mdps.river_swim.river_swim import RiverSwimMDP
@gin.configurable
class RiverSwimEpisodic(EpisodicMDP, RiverSwimMDP):
... | StarcoderdataPython |
3506756 | <reponame>NatanaelAntonioli/PiramidesCopaDoMundo<filename>Buscador.py
# --------------- PRELIMINARES ------------------------
#Dependências
import xlrd #Precisa de pip
import xlwt #Precisa de pip
import math
# Mapeia letra para número
def letra(letra):
return (ord(letra)) - 97
# Retorna o valor ... | StarcoderdataPython |
1648499 | from functools import reduce # Required in Python 3
from typing import Iterable, TypeVar
import operator
T = TypeVar('T')
def prod(iterable: Iterable[T]) -> T:
"""
Returns the product of the elements in the given iterable.
"""
return reduce(operator.mul, iterable, 1)
| StarcoderdataPython |
345822 | <gh_stars>1-10
def build_model_filters(model, query, field):
filters = []
if query:
# The field exists as an exposed column
if model.__mapper__.has_property(field):
filters.append(getattr(model, field).like("%{}%".format(query)))
return filters
| StarcoderdataPython |
280496 | <gh_stars>10-100
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,... | StarcoderdataPython |
6500688 | <filename>research/nlp/seq2seq/src/seq2seq_model/components.py
# Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses... | StarcoderdataPython |
8045770 | import os
import unittest
import pikepdf
import pdf_preflight.rules as rules
import pdf_preflight.profiles as profiles
pdf_folder = os.path.join(os.path.dirname(__file__), "pdfs")
class TestPdfPreflight(unittest.TestCase):
def test_profile__pdfa1a(self):
filename = os.path.join(pdf_folder, "pdfa-1a.pdf... | StarcoderdataPython |
1832128 | # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from github_com.TheThingsNetwork.api.gateway import gateway_pb2 as github_dot_com_dot_TheThingsNetwork_dot_api_dot_gateway_dot_gateway__pb2
from github_com.TheThingsNetwork.api.router import router_pb2 as github_dot_com_dot_TheThingsNetw... | StarcoderdataPython |
9645815 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2020-04-07 20:22:19
# @Author : 崔立波 (<EMAIL>)
# @Link : http://blog.sina.com.cn/dejavu1
# @Version : 1
import requests
import time
from docx import Document
from docx.shared import Inches
from docx.shared import Pt
from docx.oxml.ns import qn
from docx.e... | StarcoderdataPython |
3580315 |
class BaseManager:
@classmethod
async def delete(cls, obj_id):
result = await cls.update_one(
{"$or": [{"activity.object.id": obj_id},
{"activity.id": obj_id}],
"deleted": False},
{'$set': {"deleted": True}}
)
return result.mod... | StarcoderdataPython |
6514656 | <reponame>UltrosBot/Ultros3K<filename>src/ultros/core/networks/__init__.py
# coding=utf-8
"""
Networks - TODO: Describe
Modules
=======
.. currentmodule:: ultros.core.networks
.. autosummary::
:toctree: networks
base
manager
"""
__author__ = "<NAME>"
| StarcoderdataPython |
1606285 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import s3direct.fields
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Episode',
fields=[
('id'... | StarcoderdataPython |
6616137 | <filename>UDPFileSender.py
import socket
import sys
#create file
def createFile():
with open("file_object.txt", 'w') as fileContent:
fileContent.write('This is just cray cray\n')
fileContent.close()
#read file
def readFile():
with open('file_object.txt', 'r') as fileContent:
content = ... | StarcoderdataPython |
8115247 | result = 0
"""Sue 500: pomeranians: 10, cats: 3, vizslas: 5"""
sues = []
with open("input.txt", "r") as input:
for line in input:
line = line.strip().replace(":", "").replace(",", "")
data = line.split()
keys = [s for (i, s) in enumerate(data) if i % 2 == 0]
values = [int(s) for (i,... | StarcoderdataPython |
1741900 | <reponame>Oscar-Oliveira/Python3
"""
Aritmetic
"""
a = 2 + 2
print("a = 2 + 2 = {}".format(a))
a = a - 2
print("a - 2 = {}".format(a))
a = a * 2
print("a = a * 2 = {}".format(a))
a = a / 2
print("a = a / 2 {}".format(a)) # The result of division is always a float
print()
a = a ** 2 # Exponentiation (x**... | StarcoderdataPython |
6613814 | <filename>2018/aoc2018_5b.py<gh_stars>1-10
# Advent Of Code 2018, day 5, part 2
# http://adventofcode.com/2018/day/5
# solution by ByteCommander, 2018-12-05
from collections import deque
from string import ascii_lowercase
with open("inputs/aoc2018_5.txt") as file:
whole_molecule = file.read().strip()
shortest = ... | StarcoderdataPython |
8019458 | def find_license_gitlab():
""" """
| StarcoderdataPython |
8125359 | <gh_stars>10-100
"""banning support
Revision ID: 804005e79950
Revises: <KEY>
Create Date: 2019-08-16 21:34:36.679754
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '804005e79950'
down_revision = '<KEY>'
branch_labels = None
depends_on = None
def upgrade():
... | StarcoderdataPython |
4897279 | <reponame>Osmose/olympia
from django.conf.urls import include, url
from django.shortcuts import redirect
from olympia.amo.urlresolvers import reverse
from olympia.browse.feeds import (
ExtensionCategoriesRss, FeaturedRss, SearchToolsRss, ThemeCategoriesRss)
from . import views
impala_patterns = [
# TODO: Imp... | StarcoderdataPython |
11338872 | <gh_stars>0
# flake8: noqa
import rastervision.pipeline
from rastervision.core.box import *
from rastervision.core.data_sample import *
from rastervision.core.predictor import *
from rastervision.core.raster_stats import *
# We just need to import anything that contains a Config, so that all
# the register_config dec... | StarcoderdataPython |
4969353 | <filename>dev-test/Daniel_version_of_code/3D_Animation_Daniel.py
"""
@author: Daniel
"""
import scipy as sp
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D #imports the required part to add the 3rd axis for plot to becomde 3D
import matplotlib.animation as animation
###############... | StarcoderdataPython |
3356205 | #
# Copyright 2013 Intel Corp.
# Copyright 2014 Red Hat, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | StarcoderdataPython |
3251562 | <reponame>vtta2008/pipelineTool
# -*- coding: utf-8 -*-
"""
Script Name: FooterCheckBoxes.py
Author: <NAME>/Jimmy - 3D artist.
Description:
"""
# -------------------------------------------------------------------------------------------------------------
from pyPLM.Widgets import GroupGrid
class FooterCheckBoxes(... | StarcoderdataPython |
4831446 | <reponame>JulieRossi/drf-friendly-errors
from django.template.defaultfilters import title
from rest_framework import serializers
from rest_framework.exceptions import ValidationError
from rest_framework_friendly_errors.mixins import FriendlyErrorMessagesMixin
from tests.models import LANGUAGE_CHOICES, Snippet
def is_... | StarcoderdataPython |
11277419 | <reponame>simflin/tf-explorer<filename>tf-explorer.py
#!/usr/bin/env python
import cmd
import getopt
import numpy as np
import os
import sys
class Node:
def __init__(self, parent, name, is_terminal):
self.parent = parent or self
self.name = name
self.children = []
self.is_terminal = is_terminal
... | StarcoderdataPython |
6613372 | # -*- coding: utf-8 -*-
from scrapy import Spider, Request
from ..items import ChannelItem, RoomItem
import json
class BilibiliSpider(Spider):
name = 'bilibili'
allowed_domains = ['bilibili.com']
start_urls = [
'http://live.bilibili.com/area/live'
]
custom_settings = {
'SITE': {
... | StarcoderdataPython |
113669 | #encoding=utf-8
import re
RE_SEN_SPLITER = u"(.+?(\r|\n|。|!|!|\?|?|;|;|……))"
def get_sentences(text):
if not isinstance(text, (unicode,)): return []
s = re.sub(RE_SEN_SPLITER, lambda x: x.group(0)+"\t", text)
return [x.strip() for x in s.split('\t') if x.strip() != '']
if __name__ == "__main__":
tex... | StarcoderdataPython |
11212047 | import subprocess
test_number = 1
while True:
try:
file = open("./system_tests/test" + str(test_number) + ".txt", 'r')
except Exception:
print("OK", test_number - 1, "tests passed")
exit()
result = subprocess.run(["python3", "solution.py"], stdin=file, stdout=subprocess.PIPE)
... | StarcoderdataPython |
47685 | """
define model for gp
"""
# from threading import Thread
# from queue import Queue
from multiprocessing import Pool
from random import random, randint
from math import floor
import operator
from autoprover.gp.gene import Gene
from autoprover.gp.rule import GeneRule
from autoprover.gp.action import GeneAction
from aut... | StarcoderdataPython |
11395929 | import jaydebeapi
import sys
argv = sys.argv
multicast_address = argv[1] # default : 192.168.127.12
port_no = argv[2] # default : 41999
cluster_name = argv[3]
username = argv[4]
password = argv[5]
url = "jdbc:gs://" + multicast_address + ":" + port_no + "/" + cluster_name
conn = jaydebeapi.connect("com.toshiba.mwclo... | StarcoderdataPython |
1829830 | import re
from typing import Any
from typing import Dict
from email_validator import EmailNotValidError
from email_validator import validate_email
from simpleeval import EvalWithCompoundTypes as Evaluator
from simpleeval import InvalidExpression
from .questions import Validator
class ValidationError(Exception):
... | StarcoderdataPython |
4836293 | <reponame>Slovty/py-study
#!/usr/bin/python
print("你好,世界")
| StarcoderdataPython |
5183398 | <filename>services/restapi/rest/apps.py
from django.apps import AppConfig
class RestkoConfig(AppConfig):
name = 'rest'
| StarcoderdataPython |
3505640 |
from random import randint, choice
import numpy as np
# from matplotlib import pyplot as #plt
from copy import deepcopy
from sklearn import preprocessing
import torch
from tqdm import tqdm
mima = preprocessing.MinMaxScaler()
class Entropy(object):
def normalize(self, a):
return mima.fit_transform(a... | StarcoderdataPython |
5185714 | #!/usr/bin/env python
import re
# Helper functions to construct raw regular expressions "strings" (actually byte strings)
def group(content: bytes) -> bytes:
return rb"[" + content + rb"]"
def named_regex_group(name: str, content: bytes) -> bytes:
group_start = rb"(?P<" + name.encode("ascii") + rb">"
... | StarcoderdataPython |
74253 | from .DistributedMinigameAI import *
from direct.distributed.ClockDelta import *
from direct.interval.IntervalGlobal import *
from direct.fsm import ClassicFSM
from direct.fsm import State
from direct.actor import Actor
from . import DivingGameGlobals
import random
import random
import types
class DistributedDivingGam... | StarcoderdataPython |
11302214 | <filename>python/pacific_atlantic_water_flow.py
'''
Given an m x n matrix of non-negative integers representing the height of each unit cell in a continent, the "Pacific ocean" touches the left and top edges of the matrix and the "Atlantic ocean" touches the right and bottom edges.
Water can only flow in four directio... | StarcoderdataPython |
8067396 | <filename>fastinference/inference/__init__.py
from .inference import *
from .text import * | StarcoderdataPython |
3326902 | import enum
import json
import importlib
import subprocess
import shutil
from pathlib import Path
import os
from typing import Tuple, Iterable
import antlr4 # type: ignore
from . import util
class FormatType(str, enum.Enum):
s_expr = "s-expr"
json = "json"
def format_token(self, token: antlr4.Token) -> ... | StarcoderdataPython |
5064419 | <reponame>drcsturm/project-euler
# Euler discovered the remarkable quadratic formula:
# n2+n+41
# It turns out that the formula will produce 40 primes for the consecutive integer values 0≤n≤39
# . However, when n=40,402+40+41=40(40+1)+41 is divisible by 41, and certainly when n=41,412+41+41
# is clearly divisible by... | StarcoderdataPython |
8162118 | <filename>continuum/data_utils.py
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
import torch
import os
from torchvision import datasets, transforms
import numpy as np
import imageio
from .datasets.LSUN import load_LSUN
from .datasets.cifar10 import load_Cifar10
from .datasets.cifar100 impo... | StarcoderdataPython |
3397136 | #importar cosas
from tkinter import *
from tkinter import messagebox
import os
from time import strftime
import time
import pickle
import random
import os
import sys
import fpdf
from fpdf import FPDF
global continuo
continuo=0
def VentanaPrincipal():
#configuracion ventana principal
Ventana_C=Tk... | StarcoderdataPython |
6701935 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 11 17:10:49 2020
@author: <NAME>
In this code a Hamiltonian Neural Network is designed and employed
to solve a system of four differential equations obtained by Hamilton's
equations for the the Hamiltonian of Henon-Heiles chaotic dynamical.
"""
imp... | StarcoderdataPython |
8189165 | from .actor_critic import Actor, Critic
| StarcoderdataPython |
5176922 | <filename>addresses/IANA.py<gh_stars>0
#!/usr/bin/env python
class Networks(object):
def __init__(self, url=None):
self.networks = {
'0.0.0.0/8': 'IANA - Local Identification',
'10.0.0.0/8': 'IANA - Private Use',
'172.16.31.10/10': 'IANA - Shared Address Space',
... | StarcoderdataPython |
323943 | <filename>tests/integration/misc/test_generation.py
from selenium.webdriver.support.select import Select
from selenium.webdriver.support.ui import WebDriverWait
app = """
library(dash)
library(dashGeneratorTestComponentNested)
library(dashGeneratorTestComponentStandard)
app <- Dash$new()
app$layout(html$div(list(
... | StarcoderdataPython |
5043221 | from __future__ import division, print_function, absolute_import
import tensorflow as tf
from tf_layers import *
from tf_selu import selu
import math
def getNetwork(t):
print("using AE", t)
if t == 'wide':
return Regression_Wide
if t == 'encoded':
return Regression_Encoded
if t == 'ch... | StarcoderdataPython |
6427508 | <reponame>ModelDBRepository/137676
#encoding: utf-8
"""
images.py -- Toolbox functions for creating and handling image output
Exported namespace: image_blast, array_to_rgba, array_to_image
Written by <NAME>
Center for Theoretical Neuroscience
Copyright (c) 2007-2008 Columbia Unversity. All Rights Reserved.
This so... | StarcoderdataPython |
8067726 | # describes the functionality tha ta player can have in game
class Ability():
LEFT, RIGHT, JUMP, DOUBLE_JUMP, DROP = range(5) #how to make terrible enums
| StarcoderdataPython |
11284269 | <gh_stars>1000+
from rssant_api.models.story_storage.common.story_key import StoryId, hash_feed_id
def test_hash_feed_id():
for i in [0, 1, 2, 7, 1024, 2**31, 2**32 - 1]:
val = hash_feed_id(i)
assert val >= 0 and val < 2**32
def test_story_id():
cases = [
(123, 10, 0x7b000000a0),
... | StarcoderdataPython |
4842355 | <gh_stars>1-10
class Solution:
def shortestCommonSupersequence(self, A: str, B: str) -> str:
m, n = len(A), len(B)
dp = [[""] * (n + 1) for _ in range(m + 1)]
for i in range(1, m + 1):
for j in range(1, n + 1):
if A[i - 1] == B[j - 1]:
dp[i][j]... | StarcoderdataPython |
3261498 | <reponame>Albert-91/precon<filename>src/precon/exploring.py
import logging
from dataclasses import dataclass
from functools import reduce
from typing import List, Tuple
import math
from precon.devices_handlers.distance_sensor import get_distance
from precon.devices_handlers.driving_engines import turn_right_on_angle, ... | StarcoderdataPython |
11352244 | """
monobit.image - fonts stored in image files
(c) 2019--2021 <NAME>
licence: https://opensource.org/licenses/MIT
"""
import logging
from collections import Counter
from pathlib import Path
try:
from PIL import Image
except ImportError:
Image = None
from ..scripting import pair, rgb
from ..binary import ce... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.