id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
3348423 | #!/bin/python
# manage.sh
# SQL docker launcher
#
# Created by <NAME> on 23/06/2018.
# Copyright (c) 2018 <NAME>. All rights reserved.
# Repository created by <NAME>, You should read LICENSE.
from sqlalchemy import Column, Integer, String, Float, DateTime, Date, ForeignKey, Text
from sqlalchemy.orm import relationshi... | StarcoderdataPython |
4819726 | # ref: https://symfoware.blog.fc2.com/blog-entry-2288.html
# this python file requires you to install roslibpy module by
# `pip install roslibpy`
#
import time
import roslibpy
import sys
connection_flag = True
input_file_name = "test_data.txt"
# print the working space location, to debug reading directory issue
imp... | StarcoderdataPython |
62639 | <reponame>scionrep/scioncc_new<filename>src/ion/data/persist/test/test_hdf5_persist.py
#!/usr/bin/env python
__author__ = '<NAME>'
from nose.plugins.attrib import attr
import gevent
import yaml
import os
import random
from pyon.util.int_test import IonIntegrationTestCase
from pyon.public import BadRequest, NotFound,... | StarcoderdataPython |
1763475 | <reponame>Jatin-WIAI/ct-segmentation<gh_stars>0
# Training code for TB Ultrasound classification task
# Usage: See `train.sh` for a sample run command
# NOTE:
# - Default config version is `v0` for quick testing
# - Do not run the code with existing versions. This might
# overwrite the exisiting checkpoints.
# Usage... | StarcoderdataPython |
3334064 | <gh_stars>0
def get_center_and_bounds(weighted = False): #22, 23
if weighted:
bin_count = {'valence': [27425, 20326, 35916, 46624, 48919, 51225, 56399, 63890, 79380, 75452, 271361,
263633, 169472, 107129, 71913, 63248, 44008, 31391, 23231, 30242],
'arou... | StarcoderdataPython |
137242 | from datetime import datetime
from rest_framework import serializers
from .models import Block, Transaction
class BlockModelSerializer(serializers.ModelSerializer):
blockNumber = serializers.ReadOnlyField()
timeStamp = serializers.ReadOnlyField()
timeStampDateTime = serializers.SerializerMethodField()
... | StarcoderdataPython |
1799298 | <gh_stars>0
import sqlite3
import pymongo
import pandas as pd
import json
client = pymongo.MongoClient("Your client name")
db = client.test
# Write titanic data
# df = pd.read_csv('titanic.csv')
# print(df.head())
# data = (df.to_dict(orient = 'records'))
# print(data)
# result = db.test.insert_many(data)
# Confirm... | StarcoderdataPython |
3267567 | """Тестирование построения многоугольников зон влияния"""
from __future__ import annotations
from pathlib import Path
import unittest
from geometry import Point
from model import Grid
from processing import BoundaryBuilder, Xgml
from tests.mocks import ConfigMock, get_test_grid
from tests.utils import clean_directory,... | StarcoderdataPython |
175342 | #!/usr/bin/env python
import numpy as np
import scipy.stats as stats
import itertools
import matplotlib
from matplotlib import cm
from matplotlib.ticker import FuncFormatter
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import sklearn as sk
import sklearn.linear_model
from volcanic.helpers import bround
from ... | StarcoderdataPython |
139512 | import psycopg2
def createStops(conn):
c = conn.cursor()
c.execute('''
CREATE TABLE IF NOT EXISTS stops(
stop_id TEXT PRIMARY KEY,
name TEXT,
lon DOUBLE PRECISION,
lat DOUBLE PRECISION);
''')
c.execute('''CREATE INDEX CONCURRENTLY IF NOT EXISTS
lon... | StarcoderdataPython |
3296601 | <gh_stars>1-10
import numpy as np
import unittest
import chainer
from chainer import initializers
from chainer import testing
from chainer.testing import attr
from chainercv.links.model.ssd import Normalize
@testing.parameterize(*testing.product({
'shape': [(5, 5), (25, 25), (5, 25)],
'n_channel': [1, 10],
... | StarcoderdataPython |
1710080 | import datetime
from my_app import db
class Product(db.Document):
created_at = db.DateTimeField(
default=datetime.datetime.now, required=True
)
key = db.StringField(max_length=255, required=True)
name = db.StringField(max_length=255, required=True)
price = db.DecimalField()
def __repr... | StarcoderdataPython |
1618492 | <reponame>bopopescu/Lauecollect<filename>settings/sample_translation/start_settings.py<gh_stars>0
= 11.75
| StarcoderdataPython |
1700283 | import requests
class AutobuilderGitHub:
"""
This class provide basic integration of github without extra dependencies
This basicly only supports get/post api requests and build statuses updates
Please provide a valid github api token on the config file
"""
def __init__(self, components):
... | StarcoderdataPython |
1796969 | """
//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
//_/
//_/ CopyRight(C) K.Tsunoda(AddinBox) 2001 All Rights Reserved.
//_/ ( http://www.h3.dion.ne.jp/~sakatsu/index.htm )
//_/
//_/ この祝日判定コードは『Excel:kt関数アドイン』で使用しているものです。
//_/ この関数では、2007年施行の改正祝日法(昭和の日)までを
//_/ サポートしています(9月の国民の休日を含む)。
//_/... | StarcoderdataPython |
1657035 | <gh_stars>0
#!/usr/bin/env python
mem={}
#lucas?
def no_adjacent_cyclic(n):
# if n==1: return 2
if n==1: return 1
if n==2: return 3
if n in mem: return mem[n]
ret = mem[n] = no_adjacent_cyclic(n-1)+no_adjacent_cyclic(n-2)
return ret
arr = [0]*64
for i in xrange(64):
a = not not (i&(1<<5))
... | StarcoderdataPython |
97898 | <reponame>pavelnikitiuk/nan-marshal
{
"target_defaults":
{
"cflags" : ["-Wall", "-Wextra", "-Wno-unused-parameter"],
"include_dirs": ["<!(node -e \"require('..')\")", "<!(node -e \"require('nan')\")",]
},
"targets": [
{
"target_name" : "primeNumbers",
"sources" : [ "cpp/primeNumbers.cpp"... | StarcoderdataPython |
73042 | from ldtcommon import ATTR_SURFACING_PROJECT
from ldtcommon import ATTR_SURFACING_OBJECT
from ldtcommon import TEXTURE_FILE_PATTERN
from ldt import context
from ldtui import qtutils
"""
.. module:: Maya import material
:synopsis: MayaTextureImport Plugin. Imports textureSets to maya Surfacing Projects
.. moduleauth... | StarcoderdataPython |
1759500 | <filename>devtools/identify_failing_build_options.py
#!/usr/bin/env python
import os
always_on = [
'minimal',
]
always_off = [
'leapfetch',
]
other = [
'debug',
'chrpath',
'ipv6',
'manbuild',
'nostrip',
'slow',
'profiling',
'libQgpsmm',
]
knobs = [
'aivdm',
'ashtech'... | StarcoderdataPython |
87614 | from re import A
import boto3
import botocore
import click
import configparser
from csv import DictWriter
import io
import itertools
import json
import mimetypes
import os
import re
import sys
import textwrap
from . import policies
def bucket_exists(s3, bucket):
try:
s3.head_bucket(Bucket=bucket)
... | StarcoderdataPython |
44927 | <filename>src/plottoolbox/skill_metrics/pc_bias.py
# -*- coding: utf-8 -*-
import numpy as np
from . import utils
def pc_bias(simulated, observed):
"""
Calculate the percent bias between simulated and observed.
B = 100.0*sum(s-o)/sum(o)
where s is the simulated values, and o is the observed values.... | StarcoderdataPython |
178603 | import copy
import math
from connectfour.agents.computer_player import RandomAgent
def close_to_win(board, id):
score = 0
board_cp = copy.deepcopy(board)
for i in range(board_cp.width):
if board_cp.try_move(i) == -1:
continue
sub_board = board_cp.next_state(id, i)
if s... | StarcoderdataPython |
4828500 | <reponame>facebookresearch/image-to-set<filename>src/data_loader.py
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import lmdb
import numpy as np
import os
import pickle
import torch
import ... | StarcoderdataPython |
41428 | # Copyright 2014 SolidBuilds.com. All rights reserved
#
# Authors: <NAME> <<EMAIL>>
from flask import Blueprint, redirect, render_template
from flask import request, url_for
from flask_user import current_user, login_required, roles_required
from app import db
from app.models.user_models import UserProfileForm
boo... | StarcoderdataPython |
3284454 | <gh_stars>1-10
from selenium.webdriver.common.by import By
from uitestcore.page import BasePage
from uitestcore.page_element import PageElement
class SimpleTestPage(BasePage):
endpoint = ""
expected_element = PageElement(By.XPATH, "//h1[contains(.,'Overview')]")
def go_to_page(self, base_url):
se... | StarcoderdataPython |
1663812 | <gh_stars>1-10
"""
mcpython - a minecraft clone written in python licenced under the MIT-licence
(https://github.com/mcpython4-coding/core)
Contributors: uuk, xkcdjerry (inactive)
Based on the game of fogleman (https://github.com/fogleman/Minecraft), licenced under the MIT-licence
Original game "minecraft" by Mojang... | StarcoderdataPython |
3256111 | #!/usr/bin/python3
# ******************************************************************************
# Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
# licensed under the Mulan PSL v2.
# You can use this software according to the terms and conditions of the Mulan PSL v2.
# You may obtain a c... | StarcoderdataPython |
3381590 | <filename>Codechef/PLANEDIV.py<gh_stars>1-10
from collections import defaultdict
from fractions import gcd
def res():
for _ in range(int(input())):
n=int(input())
s=defaultdict(set)
for i in range(n):
a,b,c=map(int,input().split())
g=gcd(a,b)
h=gcd(g,c)
... | StarcoderdataPython |
1793045 | <filename>server/processes/migrations/0035_auto_20190728_1724.py
# Generated by Django 2.2.2 on 2019-07-28 17:24
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('processes', '0034_auto_20190728_1709'),
]
operations = [
migrations.Ren... | StarcoderdataPython |
65863 | <reponame>pyconjp/pyconjp-website
from django.conf import settings
from django.core.mail.message import EmailMessage
from django.template import Context
from django.template.loader import get_template
from pycon.finaid.models import FinancialAidApplication, \
FinancialAidApplicationPeriod
DEFAULT_EMAIL_ADDRESS = ... | StarcoderdataPython |
3230143 | <filename>xos/synchronizer/test_voltha_client.py
# Copyright 2020-present Open Networking Foundation
#
# 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... | StarcoderdataPython |
1717167 | <reponame>haoxiangsnr/SNR-Based-Progressive-Learning-of-Deep-Neural-Network-for-Speech-Enhancement
import os
import shutil
import time
import librosa
import numpy as np
from tqdm import tqdm
def corrected_length(clean_y, noise_y):
"""
合成带噪语音前的长度矫正,使 len(clean_y) == len(noise_y)
"""
if le... | StarcoderdataPython |
3238695 | #!/usr/bin/env python
# Description: ROS Node to measure and monitor quality of Wi-Fi link such as the RSSI (received signal strength), LQI (Link Quality Indicator), and the connection status.
# Author: <NAME> <EMAIL>
# License: MIT
import os
import rospy
from network_analysis.msg import WirelessLink
import std_msgs.m... | StarcoderdataPython |
3256093 | <reponame>yannikbehr/seiscomp3
#*****************************************************************************
# nettab.py
#
# This implemented the first version of the nettab file fomart currently
# replaced by the nettab2 format. For more information about the nettab2
# format look on the lineType.py and nodesncsl.py... | StarcoderdataPython |
3324752 | <gh_stars>1-10
from functools import partial
from PyQt5.QtCore import QObject, pyqtSignal
class TaskWorker(QObject):
"""This TaskWorker is a worker class to move into QThread.
It takes a task function and arbitrary number of that function's parameters.
Only A simple run method is implemented, which calls... | StarcoderdataPython |
1690648 | from __future__ import unicode_literals
import binascii
import base64
import hashlib
import re
import json
from .common import InfoExtractor
from ..compat import (
compat_ord,
compat_urllib_parse_unquote,
compat_urllib_parse_urlencode,
)
from ..utils import (
ExtractorError,
sanitized_Request,
)
... | StarcoderdataPython |
1688628 | <reponame>ytyaru/Python.Database.201706300700
import re
p = re.compile(r'foreign key[ ]*\(["]?(?P<word>\w+["]?)\)[ ]+references[ ]+(?P<table>\w+)[ ]*\((?P<column>\w+)\)')
m = p.search('foreign key(Id) references ParentTable(Column)')
print(m.group('word'), m.group('table'), m.group('column'))
m = p.search('foreign key... | StarcoderdataPython |
1701031 |
from splinter import Browser
from bs4 import BeautifulSoup
import time
import requests
import os
import pandas as pd
def init_browser():
# @NOTE: Replace the path with your actual path to the chromedriver
executable_path = {"executable_path": "chromedriver.exe"}
return Browser("chrome", **execu... | StarcoderdataPython |
1629355 | <gh_stars>0
# -*- coding:utf-8 -*-
#############################################################################
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.
#
# openGauss is licensed under Mulan PSL v2.
# You can use this software according to the terms
# and conditions of the Mulan PSL v2.
# You may obtain a cop... | StarcoderdataPython |
4835984 | <reponame>htwangtw/pydra-fsl
from pydra.engine import specs
from pydra import ShellCommandTask
import typing as ty
def FAST_output(field, in_files, out_basename):
import attr
if out_basename in [None, attr.NOTHING]:
out_basename = in_files[-1]
name = field.name
if name == "tissue_class_map":
... | StarcoderdataPython |
1709540 | from unittest.mock import MagicMock
import pytest
import numpy as np
import scipy as sp
import scipy.stats
import tensorflow as tf
from decompose.likelihoods.normal2dLikelihood import Normal2dLikelihood
from decompose.tests.fixtures import device, dtype
from decompose.distributions.distribution import UpdateType
@py... | StarcoderdataPython |
1653916 | <reponame>hoprnet/hoprsim
import mysql.connector
import hoprsim
import numpy
class gameCache:
# on start, all functions are called directly to initialize global objects
# just for clarity - summary of all properties that are assigned in respective functions:
"""
cnx = [] # mySQL connection
... | StarcoderdataPython |
25933 | <filename>awslambda/python_requirements/_python_project.py
"""Python project."""
from __future__ import annotations
import logging
import shutil
from typing import TYPE_CHECKING, ClassVar, Optional, Set, Tuple
from runway.compat import cached_property
from typing_extensions import Literal
from ..base_classes import ... | StarcoderdataPython |
107235 | #!/usr/bin/env python3
import subprocess
import sys
import os
import cgi, cgitb
#
from jinja2 import Environment, FileSystemLoader
# Import config.py
with open('/etc/footloose-vpc/footloose-vpc.conf') as f:
config_path = f.read().split('\n')[0]
sys.path.insert(0, config_path)
import config as cfg
# Import module... | StarcoderdataPython |
4812850 | <reponame>ghiandFe/game_deals_backend<filename>deals/migrations/0003_auto_20210904_1726.py
# Generated by Django 3.2.6 on 2021-09-04 15:26
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('deals', '0002_store_internal_name'),
]
operations = [
... | StarcoderdataPython |
3333097 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.BaseOpenApiResponseHeaderDTO import BaseOpenApiResponseHeaderDTO
class AlipayPayApplepayTransactionauthtokenCreateResponse(AlipayResponse):
def __init__(self):
... | StarcoderdataPython |
61870 | <reponame>GroupProjectSem3/Haley
# Generated by Django 3.0.5 on 2020-10-22 23:00
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='User_profile',
fields=[
... | StarcoderdataPython |
1723446 | <reponame>ynakayama/flask-app-template
from settings import Settings
import os
import sys
from datetime import datetime
from datetime import timedelta
import dateutil.parser
from flask import Flask, session, render_template, request, redirect, url_for, jsonify, make_response
import pandas as pd
import string
import re
... | StarcoderdataPython |
26873 | <filename>ngram_graphs/TextGraph/IGraphTextGraph.py
from igraph import Graph
def find_node_name(graph, node_idx):
return graph.vs[node_idx]["name"]
class IGraphTextGraph(Graph):
def __init__(self):
super().__init__(directed=True)
def __copy__(self):
g = IGraphTextGraph()
for v i... | StarcoderdataPython |
3274585 | <filename>pybullet/tasks/walk/sim_walk.py
import pickle as pk
import numpy as np
import sys, time
sys.path.append('../../envs')
import pybullet as pb
from humanoid import PoppyHumanoidEnv, convert_angles
env = PoppyHumanoidEnv(pb.POSITION_CONTROL, show=True)
N = len(env.joint_index)
# got from running camera.py
cam ... | StarcoderdataPython |
1617470 | <filename>scripts/scil_apply_warp_to_tractogram.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Warp *.trk using a non linear deformation.
Can be used with Ants or Dipy deformation map.
For more information on how to use the various registration scripts
see the doc/tractogram_registration.md read... | StarcoderdataPython |
3287689 | import tensorflow as tf
from tensorflow.keras.preprocessing.image import ImageDataGenerator
from tensorflow.keras.wrappers.scikit_learn import KerasClassifier
from sklearn.metrics import confusion_matrix
from sklearn.metrics import auc, roc_curve
from pathlib import Path
import seaborn as sb
import matplotlib.pyplot as... | StarcoderdataPython |
4816686 | from django.http import HttpResponse
from django.shortcuts import render
from .forms import DramatiqLoadGraphForm
from .apps import DjangoDramatiqConfig
# load_graph permission function
DRAMATIQ_LOAD_GRAPH_PERM_FN = DjangoDramatiqConfig.load_graph_perm_fn()
# plotly lib
DRAMATIQ_LOAD_GRAPH_PLOTLY_LIB = DjangoDramatiq... | StarcoderdataPython |
3346903 |
from ingest.ingest import IngestSystem
import roperations
import pymongo
import os
import csv
import sqlite3
import nltk
import re
from pprint import pprint
from nltk.corpus import stopwords
import pickle
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.pipeline import Pipeline, FeatureUnion
fr... | StarcoderdataPython |
151738 | <reponame>Leeleo3x/Solythesis<filename>scripts/py/run_on_aws.py
import boto3
import paramiko
import subprocess
import time
import sys
from multiprocessing import Pool
from scp import SCPClient
from utils import *
IOPS=12500
INSTANCE = "m5"
def create_new_instance(count, security_group='all-open', image_id="ami-0e65a0... | StarcoderdataPython |
1636020 | import asyncio
import json
import logging
import os.path
import threading
from logging import Formatter
from time import sleep
from typing import Optional
from getmac import get_mac_address as gma
from sqlalchemy.exc import OperationalError
from tornado.platform.asyncio import AnyThreadEventLoopPolicy
from angrmanag... | StarcoderdataPython |
1644473 | from abc import abstractproperty
from typing import Iterator
from river import compose, linear_model, metrics, optim, preprocessing
from river.base import Ensemble, Estimator, Regressor
from river.metrics import Metric
class ModelSelector(Ensemble):
def __init__(self, models: Iterator[Estimator], metric: Metric)... | StarcoderdataPython |
33734 | <reponame>stdiff/emo-classifier
from typing import Dict, Any, Optional
import pandas as pd
from pytorch_lightning.loggers import LightningLoggerBase
from pytorch_lightning.loggers.base import rank_zero_experiment
from pytorch_lightning.utilities import rank_zero_only
class SimpleLogger(LightningLoggerBase):
def ... | StarcoderdataPython |
145577 | """
Script for showing results of GFDL-CM3 experiments
Author : <NAME>
Date : 21 July 2021
Version : 4 - subsamples random weight class (#8) for mmmean
"""
### Import packages
import sys
import matplotlib.pyplot as plt
import numpy as np
import cmocean as cmocean
import warnings
warnings.simplefilter(ac... | StarcoderdataPython |
3261774 | __all__ = ['seq2seq_lstm__unittest']
from tests import seq2seq_lstm_unittest
| StarcoderdataPython |
1624822 | import pytest
@pytest.mark.nightly
@pytest.mark.github_only
def test_run_stub_test():
"""
Empty test just to make sure our nightly job has something to do
"""
pass
| StarcoderdataPython |
4808802 | <reponame>pamelarussell/github-bioinformatics<gh_stars>10-100
##### Functions to build queries against GitHub dataset tables
# Number of actors by repo
def build_query_num_actors_by_repo(proj, dataset, table):
return """
SELECT
repo_name,
COUNT(*) AS num_actors
FROM (
SELECT
re... | StarcoderdataPython |
1670496 | # Generated by Django 2.0.5 on 2018-09-14 20:30
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='dedupTime',
fields=[
... | StarcoderdataPython |
1791147 | import pycompss_cli.core.utils as utils
import subprocess, os, shutil
from typing import List
from pycompss_cli.core.cmd_helpers import command_runner
# ################ #
# GLOBAL VARIABLES #
# ################ #
# ############# #
# API FUNCTIONS #
# ############# #
def local_deploy_compss(working_dir: str = "") -... | StarcoderdataPython |
3375969 | <filename>gnom.py
"""
*~ Pokus 1.0 ~*
av
Gaute Svanes Lunde
"""
from klasser import *
from prosedyrer import *
from grafikk import *
#Hoved-løkke
def gnomeloop(spiller, inv, klasser, spellbook):
qlog = klasser.questlog(1)
vassleQlog = klasser.que... | StarcoderdataPython |
3243118 | # Copyright (C) 2017 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Workflow object and WorkflowState mixins.
This contains the basic Workflow object and a mixin for determining the state
of the Objects that are mapped to any cycle tasks.
"""
import calendar
import itert... | StarcoderdataPython |
1710350 | # -*- coding: utf-8 -*-
import base64
import hashlib
import os
import struct
import sys
from Crypto.Cipher import PKCS1_OAEP
from Crypto.Hash import SHA256
from Crypto.PublicKey import RSA
from Crypto.Signature import pkcs1_15
from my_modules.getch import getch
def main():
"""メイン処理"""
argv = sys.argv
a... | StarcoderdataPython |
4816721 | #!/usr/bin/env python
"""
Subband Autocorrelation Classification (SAcC) Pitch Tracker feature
Based on Matlab code by <NAME> and <NAME>
Python port based on SRI Feature template.
2013-08-25 <NAME> <EMAIL>
"""
import os
import numpy as np
import scipy.signal
import scipy.io
import scipy.cluster.vq
# For SRI's wavread... | StarcoderdataPython |
3240802 | <reponame>vaibhav-ScaleDB/FogLAMP
# -*- coding: utf-8 -*-
# FOGLAMP_BEGIN
# See: http://foglamp.readthedocs.io/
# FOGLAMP_END
import asyncio
import os
import copy
from unittest.mock import MagicMock, patch
import pytest
from foglamp.common.plugin_discovery import PluginDiscovery, _logger
from foglamp.services.core.a... | StarcoderdataPython |
3273321 | <gh_stars>0
answer = input("what's your name? ")
print(f"Hello, {answer}")
| StarcoderdataPython |
1677608 | <reponame>jimregan/pygramadan<filename>pygramadan/singular_info.py
from .attributes import Gender
from .forms import Form
from .opers import VOWELS, VOWELS_BROAD, VOWELS_SLENDER, broaden_target, slenderise_target, syncopate
from typing import List
import re
class SingularInfo():
def __init__(self,
... | StarcoderdataPython |
3331217 | <filename>image_scaler.py
import PIL
from PIL import Image
import os
def scale_and_rotate(source, destination, basewidth = 1000):
img = Image.open(source)
wpercent = (basewidth / float(img.size[0]))
hsize = int((float(img.size[1]) * float(wpercent)))
img = img.resize((basewidth, hsize), PIL.Image.ANT... | StarcoderdataPython |
3261636 | print("hello")
print("hello.py")
print
print(dfsa")
print
| StarcoderdataPython |
1651295 | <reponame>Samarth-991/Licence_plate-Detection<gh_stars>0
import numpy as np
import cv2
import string
from src.utils import infer_utils
class Inference_engine:
def __init__(self, input_image, detector_model, nlp_model, detector_conf=0.1, nlp_conf=0.4, iou_thresh=0.5,
debug=False):
self.inpu... | StarcoderdataPython |
1702740 | <gh_stars>10-100
import mido
from mido import MetaMessage, Message, MidiFile, MidiTrack
import numpy as np
def midi2score(song,
subdivision):
mid = mido.MidiFile(song)
tempo = 0
sec_per_tick = 0
length = mid.length
time = 0
# set initial score len
for msg in mid:
... | StarcoderdataPython |
111085 | <reponame>lijiaying/fastsmt<filename>fastsmt/synthesis/search/neural_nets.py
"""
Copyright 2018 Software Reliability Lab, ETH Zurich
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.a... | StarcoderdataPython |
3356482 | #!/usr/bin/env python
# encoding: utf-8
# The MIT License (MIT)
# Copyright (c) 2014-2019 CNRS
# 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 limita... | StarcoderdataPython |
1739132 | <reponame>ninoseki/shodan_training
import mmh3
import requests
res = requests.get("http://example.com")
html = res.text
print(mmh3.hash(html))
| StarcoderdataPython |
1724333 | <gh_stars>1-10
from flask_wtf import FlaskForm, RecaptchaField
from wtforms import StringField, SubmitField, SelectField, SelectMultipleField, FieldList, FormField, Form, IntegerField, RadioField, FloatField
from wtforms.validators import DataRequired, Length, Required, Optional
from app.general_align_reader import Gen... | StarcoderdataPython |
120926 | <filename>estate_app/estate_app/report/property/property.py
# Copyright (c) 2013, kiran and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
from frappe import _
import frappe
def execute(filters=None):
return get_columns(), get_data(filters)
def get_data(filte... | StarcoderdataPython |
186266 | def slices(series, length):
if not series:
raise ValueError("invalid series")
if length <= 0:
raise ValueError("Length must be positive integer")
if length > len(series):
raise ValueError("Length must be less or equal to series length")
return [
series[start : start + len... | StarcoderdataPython |
65009 | """
Flask app with auto-discovery of blueprints, cli commands etc.
"""
import copy
import functools
import sys
import types
import typing
import click
import flask
from mara_app import config, layout
from mara_page import response, _, bootstrap, navigation
from werkzeug import exceptions
def module_functionalities... | StarcoderdataPython |
44786 | <filename>gillcup/futures.py
from gillcup.util.signature import fix_public_signature
class Future:
"""Wraps a future; calbacks on the wrapper are scheduled on a given Clock
To be instantiated using
:meth:`Clock.wait_for() <gillcup.clocks.Clock.wait_for()>`.
See :class:`asyncio.Future` for API docume... | StarcoderdataPython |
142573 | <filename>app/routers/event.py
from datetime import datetime as dt
from operator import attrgetter
from typing import Any, Dict, List, Optional
from fastapi import APIRouter, Depends, HTTPException, Request
from sqlalchemy.exc import SQLAlchemyError
from sqlalchemy.orm import Session
from sqlalchemy.orm.exc import Mul... | StarcoderdataPython |
135188 | """
Copyright (c) 2017 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from __future__ import unicode_literals, absolute_import
from jsonschema import ValidationError
import io
import logging
import os
import pkg... | StarcoderdataPython |
17555 | <filename>tests/test_database.py
import unittest
from selection.dbms.postgres_dbms import PostgresDatabaseConnector
from selection.index import Index
from selection.table_generator import TableGenerator
from selection.workload import Column, Query, Table
class TestDatabase(unittest.TestCase):
@classmethod
de... | StarcoderdataPython |
69444 | # Generated by Django 2.0.1 on 2018-01-19 21:02
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('tf2tags', '0003_auto_20160802_0059'),
]
operations = [
migrations.RemoveField(
model_name='user... | StarcoderdataPython |
10587 | from typing import Sequence, Any
from jina.executors.evaluators.rank import BaseRankingEvaluator
from jina.executors.evaluators.decorators import as_aggregator
class RecallEvaluator(BaseRankingEvaluator):
"""A :class:`RecallEvaluator` evaluates the Precision of the search.
It computes how many of the firs... | StarcoderdataPython |
154039 | from pytest_bdd import when, given, then
from jinja2 import Environment, FileSystemLoader
from ebu_tt_live.documents import EBUTT1Document, EBUTT3Document, \
EBUTT3DocumentSequence, EBUTTDDocument
from ebu_tt_live.bindings.converters.ebutt1_ebutt3 import EBUTT1EBUTT3Converter
from ebu_tt_live.documents.converters i... | StarcoderdataPython |
1703599 | # encoding:utf-8
import sys
from PyQt5.QtCore import Qt, pyqtSignal, QPropertyAnimation, QPoint, QAbstractAnimation, QUrl
from PyQt5.QtGui import QDesktopServices
from PyQt5.QtWidgets import QApplication, QWidget
from resource.Ui_login import Ui_Form
# 登录面板实现类,也是第一窗口
class Login(QWidget, Ui_Form):
# 定义点击登录信号、点击注... | StarcoderdataPython |
135384 | <gh_stars>0
from django.db import models
from wagtail.admin.edit_handlers import FieldPanel, InlinePanel
from wagtail.core.fields import RichTextField
from modelcluster.fields import ParentalKey
from modelcluster.models import ClusterableModel
class ApplicantType(models.Model):
applicant_type = models.CharField... | StarcoderdataPython |
1667281 | <gh_stars>10-100
import six
from abc import ABCMeta, abstractmethod
@six.add_metaclass(ABCMeta)
class CostFunction(object):
def __init__(self, ds, da, *args, **kwargs):
self.ds, self.da = ds, da
@abstractmethod
def get_parameters(self):
pass
@abstractmethod
def log_likelihood(sel... | StarcoderdataPython |
41572 | # -*- coding: utf-8 -*-
"""
P-spline versions of Whittaker functions
----------------------------------------
pybaselines contains penalized spline (P-spline) versions of all of the
Whittaker-smoothing-based algorithms implemented in pybaselines. The reason
for doing so was that P-splines offer additional user flexibi... | StarcoderdataPython |
1773715 | from .identifier import *
| StarcoderdataPython |
1774894 | # coding=utf-8
import re
from proxy import Proxy
from .basespider import BaseSpider
class UsProxySpider(BaseSpider):
name = 'usproxy'
def __init__(self, *a, **kwargs):
super(UsProxySpider, self).__init__(*a, **kwargs)
self.urls = [
'http://www.us-proxy.org/',
'http:... | StarcoderdataPython |
187410 | from os import error
from typing import NoReturn
def exists_data(attr) :
file = open("database.csv")
lines = file.readlines()
file.close()
# if lines == "" : return False
for line in lines:
words = line.split(",")
if (words[0] == attr) :
return True
return F... | StarcoderdataPython |
3358060 | # Copyright 2021 <NAME>
#
# 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 applicable law or agreed to in writing, softw... | StarcoderdataPython |
16219 | import collections
def cal(num):
i=1
f=factor[num]
while i*i<=num:
if num%i==0 and i<=max(n,m) and num//i<=max(n,m):
f.append(i)
i+=1
return num
def dfs(i,j):
if i==m-1 and j==n-1:
return True
if i>=m and j>=n or grid[i][j] in factor:
... | StarcoderdataPython |
3379708 | <filename>maestro_scripts/maestro_select_by_b_factor.py
__doc__ = """
Select residues with highest b-factor within selection.
Either return a list of residues which B-factor is above cutoff (cutoff),
or a number residues with the highest B-factor (highest).
"""
#Name: B-Select
#Command: pythonrun maestro_select_by_b_... | StarcoderdataPython |
3349336 | from django.core.management.base import BaseCommand, CommandError
from orders.models import OrderItem
import csv
class Command(BaseCommand):
help = 'Feed order_item_csv file into OrderItem table.'
def add_arguments(self, parser):
parser.add_argument('file_name', type=str, help='The csv file of order_i... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.