id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
6672346 | from flask import Flask, render_template, jsonify, redirect, request, send_from_directory
from lxml import html
from bs4 import BeautifulSoup as bs
from bson.json_util import dumps
from re import sub
from decimal import Decimal
import requests
import json
import pymongo
import pandas as pd
import numpy as np
import cs... | StarcoderdataPython |
5111716 | import sqlalchemy as sqlalchemy
from kafka import KafkaConsumer, TopicPartition
from json import loads
from contextlib import closing
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
import psycopg2
from sqlalchemy import Integer, String, Column, Sequence, create_engine, t... | StarcoderdataPython |
33833 | #python -m marbles test_semantic_columns.py
import unittest
from marbles.mixins import mixins
import pandas as pd
import requests
from pyspark.sql import SparkSession
import psycopg2 as pg
import pandas as pd
import marbles
from pyspark.sql.types import StructType, StructField, StringType
import psycopg2 as pg
#from s... | StarcoderdataPython |
11370092 | import tempfile
import cv2, win32gui, win32con, win32api, numpy as np
import time
from typing import Union, List
from pathlib import Path
from PIL import ImageGrab
class Point2D:
def __init__(self, x: int, y: int):
self.x = x
self.y = y
def to_tuple(self) -> tuple:
return (self.x,sel... | StarcoderdataPython |
88475 | from typing import List
class Solution:
def maximumScore(self, nums: List[int], multipliers: List[int]) -> int:
l = len(multipliers)
def dfs(i, j, idx=0, memo={}):
key = f'{<KEY>
if key in memo:
return memo[key]
if idx >= len(multipliers):
... | StarcoderdataPython |
6472724 | <filename>tests/test_numpy.py
#!/usr/bin/env python3
# (C) Copyright 2020 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the privileges and immunities
# grante... | StarcoderdataPython |
5143198 | # -*- coding: utf-8 -*-
"""
Author: <NAME> <<EMAIL>>
License: MIT
"""
import numpy as np
import seaborn as sns
if __name__ == "__main__":
# Parameters
dtype = "float64"
max_iter, n_dim = 10000, 2
models_file = "../output/models_%d_%d.bin" % (max_iter, n_dim)
energy_file = "../output/energy_%d.bi... | StarcoderdataPython |
6431962 | <gh_stars>0
#----------------------------------Import modules------------------------------
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.model_selection import train_test_split
from keras.models import Sequential, Model
from keras.layers import Activation, D... | StarcoderdataPython |
4984243 | <filename>cogs/commands/info/stats.py
import datetime
import os
import platform
import traceback
from math import floor
import discord
import humanize
import psutil
from asyncio import sleep
from discord.ext import commands
class Stats(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.s... | StarcoderdataPython |
9662069 | <reponame>Anphisa/city-scrapers
# THIS IS JUST A MIXIN. IT MAY USE THINGS THAT ARE NOT ACTUALLY USABLE YET,
# BUT IT WILL BE INTEGRATED INTO A REGULAR AGENCY SPIDER.
# -*- coding: utf-8 -*-
from datetime import datetime
from urllib.parse import urljoin
from dateutil.parser import parse as dateparse
from city_scraper... | StarcoderdataPython |
3494152 | """
This module provides a name_to_constructor dict for all models/estimators in scikit-learn, plus a couple test models and
error handling functions
"""
import warnings
import inspect
import sklearn.base
import sklearn.utils.testing
import joblib
import numpy as np
import os
# Sometimes xgboost is hard to install s... | StarcoderdataPython |
3316857 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Provide the Cartpole robotic platform.
"""
import os
import numpy as np
import pybullet_data
import sympy
import sympy.physics.mechanics as mechanics
from pyrobolearn.robots.robot import Robot
from pyrobolearn.utils.transformation import get_symbolic_matrix_from_axis_a... | StarcoderdataPython |
5106463 | <filename>palo_alto_pan_os/komand_palo_alto_pan_os/actions/edit/action.py
import komand
from .schema import EditInput, EditOutput
from komand.exceptions import PluginException
# Custom imports below
class Edit(komand.Action):
def __init__(self):
super(self.__class__, self).__init__(
name=... | StarcoderdataPython |
394854 | import os
import json
from tornado import template
GRAPHIQL_VERSION = '0.7.1'
MARKUP_CONTENT_TYPES = [
'text/html', 'application/xhtml+xml', 'application/xml;q=0.9'
]
def request_wants_html(mimetypes):
return set(MARKUP_CONTENT_TYPES).issubset(mimetypes)
def should_render_graphiql(accept_header_mimetypes)... | StarcoderdataPython |
3293705 | <reponame>skostya64/Music_store_test
class CheckBassNamePage:
def __init__(self, driver):
self.driver = driver
def click_menu_bass_guitars(self):
self.driver.find_element_by_xpath("//a[@href='https://www.musicstore.de/ru_OT/EUR/-/cat-BASS']").click()
def click_electric_bass_guitars(self... | StarcoderdataPython |
3520602 | <gh_stars>1-10
from typing import Optional, TYPE_CHECKING
from typing_extensions import TypedDict
if TYPE_CHECKING:
from checkov.common.models.enums import CheckResult
class _CheckResult(TypedDict, total=False):
result: "CheckResult"
suppress_comment: str
class _SkippedCheck(TypedDict, total=False):
... | StarcoderdataPython |
6694976 | import random
def bogo_sort(arr):
"""Bogo Sort
Best Case Complexity: O(n)
Worst Case Complexity: O(∞)
Average Case Complexity: O(n(n-1)!)
"""
def is_sorted(arr):
#check the array is inorder
i = 0
arr_len = len(arr)
while i+1 < arr_len:
if ... | StarcoderdataPython |
6678855 | <filename>pyqtcli/makerc.py
import os
import subprocess
from pyqtcli import verbose as v
# Error message send by pyrcc5 when qrc file doesn't contain resources
NO_QRESOURCE = b"No resources in resource description.\n"
INVALID_QRC = b"pyrcc5 Parse Error:"
def generate_rc(qrc_files, verbose):
"""Generate python ... | StarcoderdataPython |
1725367 | <reponame>projectweekend/aa<filename>aa/test_web_api.py
import datetime
import falcon
from falcon import testing
import pytest
from aa.app import create_application
from aa.unit.info import *
@pytest.fixture()
def client():
return testing.TestClient(create_application())
def test_get_a_land_battle_template(cl... | StarcoderdataPython |
8063362 | # 13. Recursive Power
# Create a recursive function called recursive_power() which should receive a number and a power.
# Using recursion return the result of number ** power. Submit only the function in the judge system.
def recursive_power(number, power):
if power == 0:
return 1
return number * recur... | StarcoderdataPython |
5124480 | <gh_stars>0
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
"""Mimic pyquick exercise -- optional extra exercise.
Google's Python Class
... | StarcoderdataPython |
9676875 | <filename>patches/droppedKey.py
from assembler import ASM
def fixDroppedKey(rom):
# Patch the rendering code to use the dropped key rendering code.
rom.patch(0x03, 0x1C99, None, ASM("""
ld a, $04
rst 8
jp $5CA6
"""))
# Patch the key pickup code to use the chest p... | StarcoderdataPython |
182790 | """Implement of fnn layer"""
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from mxnet.gluon import nn
from mxnet import nd
import numpy as np
import mxnet as mx
class FeedForwardNetwork(nn.Block):
"""Fully connected feedforward network"""
def _... | StarcoderdataPython |
1702360 | <reponame>conroy-cheers/django-sites-multidb
from django.contrib import admin
from .forms import DBConfigForm
class DBConfigAdmin(admin.ModelAdmin):
form = DBConfigForm
| StarcoderdataPython |
11219435 | <filename>phpide.py
import os
import sublime
import sys
import threading
if os.name == 'nt':
from ctypes import windll, create_unicode_buffer
class Prefs:
@staticmethod
def load():
settings = sublime.load_settings('PHPIDE.sublime-settings')
Prefs.plugins = settings.get('plugins', [])
... | StarcoderdataPython |
1605497 | <reponame>chrisliatas/py4e_code
# Use words.txt as the file name
fname = input("Enter file name: ")
try:
fh = open(fname)
except:
print('File cannot be opened:', fname)
quit()
for line in fh:
line = line.rstrip()
print(line.upper())
| StarcoderdataPython |
64877 | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2019-07-16 13:27
from __future__ import unicode_literals
import datetime
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
... | StarcoderdataPython |
3312923 | import sys,re,os,urllib,urllib2,base64,syslog,socket
# Author: <NAME>
# Website: www.williamlam.com
# Product: VMware ESXi
# Description: Python script to call into vSphere MOB to add ESXi host to VC
# Reference: http://www.williamlam.com/2011/03/how-to-automatically-add-esxi-host-to.html
# vCenter server
vcenter_serv... | StarcoderdataPython |
133549 | <filename>moabb/pipelines/__init__.py
"""
Pipeline defines all steps required by an algorithm to obtain predictions.
Pipelines are typically a chain of sklearn compatible transformers and end
with an sklearn compatible estimator.
"""
| StarcoderdataPython |
8064049 | <filename>document_similarity.py
from scipy import spatial
from preprocess import pre_process
from inference import get_inference_vector
import re
def get_document_similarity (doc_0, doc_1) :
sentences_0 = doc_0.split (".")
document_0_processed = pre_process (sentences_0)
flat_document_0 = [item for sublis... | StarcoderdataPython |
11213557 | <filename>refinery/units/strings/cupper.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from refinery.units import Unit
class cupper(Unit):
"""
Transforms the input data to uppercase.
"""
def process(self, data):
return data.upper()
| StarcoderdataPython |
202644 | from keras.applications.vgg16 import VGG16, preprocess_input, decode_predictions
from keras.optimizers import SGD
from PIL import Image
from keras.preprocessing.image import img_to_array
import numpy as np
class VGG16FeatureExtractor:
model = None
def __init__(self):
self.model = VGG16(include_top=Tr... | StarcoderdataPython |
6607254 | <filename>MessageEvents.py
#!/usr/bin/env python3
from enum import Enum
"""
Enumeration that represents the events that the server can receive
"""
class MessageEvents(Enum):
IDENTIFY = 1
STATUS = 2
USERS = 3
MESSAGE = 4
PUBLICMESSAGE = 5
CREATEROOM = 6
INVITE = 7
JOINROOM = 8
ROOME... | StarcoderdataPython |
8083277 | import re
import numpy as np
import json
from decimal import Decimal
from fuzzywuzzy import fuzz
from flask import Flask, request, jsonify
from weighted_levenshtein import lev, osa, dam_lev
app = Flask(__name__)
@app.route("/get-receipt-info", methods=["GET"])
def get_receipt_info():
receipt = request.data.decode('... | StarcoderdataPython |
4994744 | <reponame>donghun2018/adclick-simulator<filename>sim_lib.py
"""
Simulator library
<NAME> 2018
"""
import pickle
import numpy as np
from policy_loader import get_pols, get_puids
def load_auction_p(fname):
"""
loads auction output from a file
:param fname: usually, auction_???.p
:return: auct. This ... | StarcoderdataPython |
4998771 | <reponame>tsabi/modoboa-stats
"""Modoboa stats forms."""
import rrdtool
from pkg_resources import parse_version
from django.conf import settings
from django.utils.translation import ugettext_lazy
from django import forms
from modoboa.lib import form_utils
from modoboa.parameters import forms as param_forms
class ... | StarcoderdataPython |
3392963 | # Generated by Django 3.2.6 on 2021-09-15 13:39
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('order', '0005_auto_20210915_1129'),
]
operations = [
migrations.AlterModelOptions(
name='order'... | StarcoderdataPython |
3545339 | <reponame>stroxler/bottleneck
from bottleneck.slow.func import *
from bottleneck.slow.move import *
| StarcoderdataPython |
4888643 | <reponame>bryanforbes/poetry-core
# -*- coding: utf-8 -*-
import ast
import shutil
import tarfile
from email.parser import Parser
import pytest
from poetry.core.factory import Factory
from poetry.core.masonry.builders.sdist import SdistBuilder
from poetry.core.masonry.utils.package_include import PackageInclude
from... | StarcoderdataPython |
1660828 | import numpy as np
from vg.compat import v2 as vg
__all__ = [
"rectangular_prism",
"cube",
"triangular_prism",
]
def _maybe_flatten(vertices, faces, ret_unique_vertices_and_faces):
if ret_unique_vertices_and_faces:
return vertices, faces
else:
return vertices[faces]
def rectangu... | StarcoderdataPython |
4976002 | <gh_stars>0
import pytest
import json
from datetime import date
from core.models import Event
from api.serializers import EventSerializer
@pytest.mark.django_db()
class TestsEventSerialization:
@pytest.fixture()
def event(self):
instance = Event.objects.create(
event='some',
... | StarcoderdataPython |
1712002 | <reponame>Ally-s-Lab/miRmedon
import os
def alignment_to_emiRbase(fastq_file, path_to_star, threads, star_ref_dir, path_to_samtools):
params = '''--runThreadN {}
--alignIntronMin 1
--outFilterMultimapNmax 200
--outFilterMatchNmin 12
--outFilterMatchNm... | StarcoderdataPython |
11243221 | from . import outputter
import smbus
import time
# I2C通信の設定
I2C_ADDR = 0x27 # I2Cアドレス
LCD_WIDTH = 16 # 表示文字数の上限
LCD_CHR = 1 # 文字列送信モードの識別子
LCD_CMD = 0 # コマンド送信モードの識別子
LCD_LINE_1 = 0x80 # 一行目に表示する文字列の書き込み先
LCD_LINE_2 = 0xC0 # 二行目に表示する文字列の書き込み先
LCD_BACKLIGHT = 0x08 # バックライトをOFFにするコマンド
bus = smbus.SMBus(1) # 接続されて... | StarcoderdataPython |
8545 | <filename>tests/__init__.py
# -*- coding: utf-8 -*-
"""Tests go in this directory."""
| StarcoderdataPython |
1855269 | <reponame>OnionPiece/networking-ipvs
#!/usr/bin/python2.7
import os
from neutron.agent.linux import ip_lib
from networking_ipvs.common import template
from networking_ipvs.common import constants as const
class FakeConf(object):
@property
def keepalived(self):
class TemplateConf(object):
... | StarcoderdataPython |
11356690 | # Generated by Django 3.0.2 on 2020-02-12 14:02
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mortgages', '0007_auto_20200212_2101'),
]
operations = [
migrations.AlterField(
model_name='mortgageprograms',
name=... | StarcoderdataPython |
1924325 | import unittest
import numpy as np
from nuplan.common.actor_state.agent import Agent, PredictedTrajectory
from nuplan.common.actor_state.scene_object import SceneObjectMetadata
from nuplan.common.actor_state.state_representation import StateSE2, StateVector2D, TimePoint
from nuplan.common.actor_state.test.test_utils ... | StarcoderdataPython |
11348656 |
class sd:
def __init__(self,device):
self.device = device
def get_stream(self):
raise Exception("NotImplementedException")
#return ["dd", "..."]
# Create a filename with datestamp for our current backup (without .img suffix)
#ofile="/mnt/usb/backup_$(date +%d-%b-%y_%T)"
# Create fin... | StarcoderdataPython |
3586701 | # coding=utf-8
"""Overrides for Discord.py classes"""
import contextlib
import inspect
import io
import itertools
import re
import discord
from discord.ext.commands import HelpFormatter as HelpF, Paginator, Command
from bot.utils import polr, privatebin
from bot.utils.args import ArgParseConverter as ArgPC
def crea... | StarcoderdataPython |
1709001 | <filename>tests/test_theme.py
from typing import Any, Dict
import pytest
from grgr.ggplot2.theme import Theme, ThemeElement
@pytest.mark.parametrize("kwargs, answer", [
({
"foo": '"bar"'
}, 'test(foo="bar")'),
({
"foo_bar": '"bar"'
}, 'test(foo.bar="bar")'),
({
"foo": '"ba... | StarcoderdataPython |
194137 | from django.db import models
from django.contrib.auth.models import AbstractUser
from django.conf import settings
from cloudinary.models import CloudinaryField
from django.db.models.fields import EmailField
# Create your models here.
# user
#neighbourhood
#profile
#Business
class CustomUser(AbstractUser):
first_n... | StarcoderdataPython |
164888 | from django.contrib.contenttypes.fields import GenericRelation
from django.conf import settings
from django.db import models
from .custom_field import CustomField
from .model_mixins import SoftDeleteModel
class Organisation(SoftDeleteModel):
name = models.CharField(max_length=255)
owner = models.ForeignKey(s... | StarcoderdataPython |
3556345 | <filename>h2o-py/tests/testdir_algos/gbm/pyunit_mnist_manyCols_gbm_large.py
import sys
sys.path.insert(1,"../../../")
import h2o
from tests import pyunit_utils
def mnist_many_cols_gbm_large():
train = h2o.import_file(path=pyunit_utils.locate("bigdata/laptop/mnist/train.csv.gz"))
train.tail()
from h2o.estimator... | StarcoderdataPython |
1847317 | <reponame>fossabot/hotpot
import gzip
import ahocorasick
import pandas as pd
import ujson
from tqdm import tqdm
# ============================================
# Script purpose:
# Find words that contain a word within CEDICT
# ============================================
# speed up text search by using the Aho-Coras... | StarcoderdataPython |
1980619 | <reponame>jatinarora2409/scout-scripts<gh_stars>0
import getpass
import os
import time
import platform
import json
from timeit import default_timer
import datetime
import click
import executor
from executor import execute
from executor.ssh.client import RemoteCommand
from scoutcli.utils import helper
from scoutcli.ut... | StarcoderdataPython |
200156 | <gh_stars>100-1000
import sys
import json
import goramldir
import goramldir.User as User
# goramldir client
client = goramldir.Client()
def main(app_id, app_secret):
# get JWT token from itsyouonline
jwt_token = client.oauth2_client_itsyouonline.get_access_token(app_id, app_secret).text
# Set our goram... | StarcoderdataPython |
44142 | <reponame>freedmanlab/Context-Dependent-Gating<filename>plot_results.py
import numpy as np
import matplotlib.pyplot as plt
import pickle
import os
import matplotlib
from itertools import product
from mpl_toolkits.axes_grid1.inset_locator import zoomed_inset_axes
from mpl_toolkits.axes_grid1.inset_locator import mark_i... | StarcoderdataPython |
6529815 | <reponame>manju-rn/synapse
# Copyright 2021 The Matrix.org Foundation C.I.C.
#
# 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 requ... | StarcoderdataPython |
6635101 | <reponame>DowneyTung/saleor
import graphene
from ..translations.mutations import ShopSettingsTranslate
from .mutations import (
AuthorizationKeyAdd,
AuthorizationKeyDelete,
HomepageCollectionUpdate,
ShopAddressUpdate,
ShopDomainUpdate,
ShopFetchTaxRates,
ShopSettingsUpdate,
)
from .types im... | StarcoderdataPython |
6431567 | <gh_stars>0
import utils
import random
import math
class Entity(object):
def __init__(self):
self.type = "entity"
class Allie(Entity):
def __init__(self, position):
super().__init__()
self.type = "allie"
self.position = [position[0], position[1]]
self.orientation = 0
self.pv_max = 10.0
self.pv = s... | StarcoderdataPython |
1900092 | <gh_stars>1-10
"""Limited subset of azavea/django-sld's generator module
This module preserves that module's structure for extensibility,
but only borrows the as_quantiles method.
"""
import numpy as np
from django.contrib.gis.db.models import fields
from pysal.esda.mapclassify import Quantiles
from sld import (Filt... | StarcoderdataPython |
3310266 | import pytest, os,vcr
from igdb_api_python.igdb import igdb as igdb
igdb = igdb(os.environ['api_key'])
@vcr.use_cassette('tests/vcr_cassettes/platforms/single_platform.yml', filter_headers=['user-key'])
def test_single_platform():
result = igdb.platforms(11)
assert result.body != []
assert result.body[0]... | StarcoderdataPython |
1857525 | """
Raspberry Pi package.
"""
import os
import json
from .constants import ASSETS_DIR
with open(os.path.join(ASSETS_DIR, "metadata.json")) as f:
metadata = json.load(f)
__title__ = metadata["__title__"]
__description__ = metadata["__description__"]
__version__ = metadata["__version__"]
__lead__ = metadata["__lead... | StarcoderdataPython |
4912068 | <filename>core/tests/test_curriculo.py<gh_stars>0
import django
django.setup()
from core.bo.curriculo import get_curriculo_by_cc
from core.models import ComponenteCurricular
from core.tests.povoar_testes import criar_dados, remover_dados
from django.test import TestCase
class CurriculoTests(TestCase):
@classmet... | StarcoderdataPython |
3428329 | # -*- coding: utf-8 -*-
"""
Created on Mar 11, 2012
@author: moloch
Copyright 2012 Root the Box
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/licen... | StarcoderdataPython |
1799470 | from textwrap import dedent
from typing import Any, Dict, List
from shared.di import service_as_factory
from shared.postgresql_backend import ConnectionHandler
from shared.util import ModelLocked, collectionfield_and_fqid_from_fqfield
# FQID LOCKING
# positions: <1> <2> <3> <4> <5>
# a/1 modified: X X
... | StarcoderdataPython |
5073248 | import json
from discord.ext import commands, tasks
from app.classes.bot import Bot
class StatsEvents(commands.Cog):
def __init__(self, bot: Bot) -> None:
self.bot = bot
self.broadcast_stats.start()
@tasks.loop(minutes=1)
async def broadcast_stats(self) -> None:
await self.bot.w... | StarcoderdataPython |
11285987 | <filename>interface.py<gh_stars>0
import algorithm
import variable
import sys
from PyQt4.QtGui import *
from PyQt4.QtCore import *
class Window(QMainWindow):
def __init__(self):
super(Window, self).__init__()
self.initUI()
def initUI(self):
self.setGeometry(600, 300, 700, 500)
... | StarcoderdataPython |
8039189 | """
用python编程:有一个4*4的二维矩阵,请按如下图顺序输出里面的值。
"""
import numpy as np
input = np.array((1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16))
input = input.reshape(4,4)
def output_edge(input, output,direction = 0):
if(input.size == 0):
return
if direction == 0:
output.append(input[0,:].tolist())
output_edge(input[1:,:]... | StarcoderdataPython |
3253499 | #!/usr/bin/env python
from __future__ import unicode_literals
from prompt_toolkit.auto_suggest import AutoSuggest, Suggestion
from .utils import json_fixer, extract_tokens, yaml_fixer
__author__ = "<NAME>"
__copyright__ = "Copyright 2017-2021, <NAME>"
__credits__ = ["<NAME>"]
__license__ = "BSD"
__maintainer__ = "<N... | StarcoderdataPython |
3536286 | import copy
import math
import matplotlib.pyplot as plt
import numpy as np
import pybullet as p
from lark import Token
from matplotlib import cm
from sim.grasp.lib import PandaGraspEnv, update_ANGLES, min_ray, max_ray
from spatial.automaton_planning import AutomatonPlanner
from spatial.geometry import Circle, Polygon... | StarcoderdataPython |
1725747 | <reponame>hyperpower/CarpioPlus<filename>examples/4-4-1-reconstruct_eclipse/plot.py
import matplotlib
import matplotlib.pyplot as plt
import os, sys
import numpy as np
import string
import math
import operator
import multiprocessing
from multiprocessing import Pool
matplotlib.rcParams['text.usetex'] = True
mat... | StarcoderdataPython |
121117 | <reponame>guci314/Chatbot_CN<gh_stars>1-10
#!/usr/bin/env python
# coding=utf-8
"""
Get the table of actor_to_movie and movie_to_genre.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
reload(sys)
sys... | StarcoderdataPython |
1788531 | <filename>p811-subdomain-visit-count.py<gh_stars>0
# A website domain like "discuss.leetcode.com" consists of various subdomains.
# At the top level, we have "com", at the next level, we have "leetcode.com",
# and at the lowest level, "discuss.leetcode.com". When we visit a domain like
# "discuss.leetcode.com", we will... | StarcoderdataPython |
3424944 | <gh_stars>1-10
from django.db import models
from .models import *
from django import forms
class setPriceCurrencyForm(forms.ModelForm):
kwh_price = forms.FloatField(widget=forms.NumberInput(attrs={'placeholder': 'Insert price'}))
currency_name = forms.CharField(widget=forms.TextInput(attrs={'placeholder': 'Insert cu... | StarcoderdataPython |
3272554 | #!/usr/bin/python
# Gets stuff from Pitchfork's awesome 'Best New Music' section
# Note: this is just regexing the HTML... so may stop working if page structure changes
# This is not written by, or affiliated with Pitchfork at all
import urllib2
import re
def GetPitchforkData():
# grab all the data...
web_page ... | StarcoderdataPython |
1720496 | <filename>test/test_run.py<gh_stars>1-10
from copy2hash import copy2hash
from pathlib import Path
__refargs__ = {
"infile": [],
"report": ["json"],
"report_name": "copy_report",
"sha": ["sha256"],
"directory": None,
"move": False,
"file_extension": False,
"file_suffix": False,
"no_f... | StarcoderdataPython |
6576706 | <filename>backend/app/routing.py
# notify/routing.py
from django.urls import re_path
from . import consumers
websocket_urlpatterns = [
re_path(r'notify/(?P<username>\w+)/$', consumers.NotifyConsumer.as_asgi()),
]
| StarcoderdataPython |
6535149 | from . import dataset
from decoder import int_type
import os.path
import re
class _CsvDataIterCallable:
def __init__(self, file_path, converters):
self._file_path = file_path
self._converters = converters
def __call__(self):
return _CsvDataIterator(self._file_path, self._converters)
... | StarcoderdataPython |
6645812 | # coding=utf-8
# given a wav and start and end, shwo the spectrum graph
import sys,os
from ChunWai import *
#from audiolab import wavread
#from audiolab import wavwrite
#from scikits.samplerate import resample # we are not using this
import numpy as np
import matplotlib
matplotlib.use('agg')
import numpy as np
import m... | StarcoderdataPython |
12808612 | from functools import partial
from typing import NamedTuple, List
from unittest.mock import patch
import pytest
from pkgdev.scripts import run
from snakeoil.contexts import chdir, os_environ
class Profile(NamedTuple):
"""Profile record used to create profiles in a repository."""
path: str
arch: str
st... | StarcoderdataPython |
8164813 | ##############################################################################
import pandas as pd
class Handler:
"""This class handles missing data in the dataframe and removes
unninformative columns from it.
"""
@classmethod
def _identify_imputation_method(cls, method):
"""Returns the a... | StarcoderdataPython |
57910 | import pytest
from faker import Faker
from django.db.utils import IntegrityError
from django.urls import reverse
from .factory import AccountSubTypeFactory
from ..models import AccountSubType, Account
from ..choices import AccountType
fake = Faker()
class TestAccountSubType:
def test_name_field(self, db):
... | StarcoderdataPython |
6674121 | <filename>main.py
from typing import List
from fastapi import Depends, FastAPI, HTTPException
import time
import sys
from fastapi.middleware.cors import CORSMiddleware
from pydantic import BaseModel
from starlette.requests import Request
from typing import TypeVar, Generic, Type, Any
from xml.etree.ElementTree import f... | StarcoderdataPython |
5059222 | <filename>diary/models.py
from django.db import models
# Create your models here.
class React(models.Model):
name=models.CharField(max_length=50)
experience=models.CharField(max_length=500)
| StarcoderdataPython |
4939477 | <reponame>Tellvinch/illusion
import urllib.request, json
from .models import Quote
def get_quote():
with urllib.request.urlopen('http://quotes.stormconsultancy.co.uk/random.json') as url:
quote_details_data = url.read()
quote_details_response = json.loads(quote_details_data)
quote_object = ... | StarcoderdataPython |
6446573 | <filename>pcc/AST/functions/function_definition.py
from pcc.AST.ast_node import push_variable_on_stack
from pcc.AST.compiled_object import CompiledObjectType, CompiledObject
from pcc.AST.functions.function_argument import FunctionArgument
from pcc.AST.functions.function_declaration import FunctionDeclaration
from pcc.A... | StarcoderdataPython |
4842347 | import sys
from nameko.cli.main import main
main() | StarcoderdataPython |
6622874 | from django.db import models
class Coordinate(models.Model):
Unique_ID = models.CharField(max_length=128,null=True, blank=True)
Address = models.CharField(max_length=500,null=True, blank=True)
Latitude = models.CharField(max_length=32,null=True, blank=True)
Longitude = models.CharField(max_length=32,null=True, bla... | StarcoderdataPython |
79430 | # Copyright 2019 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "LICENSE.txt" file acc... | StarcoderdataPython |
248633 | """
Python 3 implementation of Qiagen Clinical Insight's API.
Installation:
- Pipenv:
pipenv install qci
- Virtualenv:
pip install qci
- Pip:
pip install qci
Usage:
- Refer to the examples/ directory for examples
Notes:
- Python 2 compatible
TODO:
- multi-threading
-... | StarcoderdataPython |
5122172 |
import sys
from PySide2.QtWidgets import *
from PySide2 import QtGui
from PySide2.QtCore import Qt
from layouts.welcome import Welcome
from layouts.data_select import DataSelect
from layouts.bulk_analysis import BulkAnalysis
from layouts.imaging import Imaging
from layouts.show_data import ShowData
from layouts.error... | StarcoderdataPython |
1820313 | <reponame>shalevy1/coco-annotator
import imantics as im
import json
from mongoengine import *
from .datasets import DatasetModel
from .categories import CategoryModel
from .events import Event
from flask_login import current_user
class AnnotationModel(DynamicDocument):
COCO_PROPERTIES = ["id", "image_id", "cat... | StarcoderdataPython |
3596935 | <gh_stars>0
#!/usr/bin/env python
import os.path
import ConfigParser
import subprocess
from pymongo import MongoClient
# Settings file
CONFIG_FILE = '/etc/otfnfv.conf'
if not os.path.isfile(CONFIG_FILE):
print "Make sure you have a %s file in /etc !" % 'otfnfv.conf'
exit(1)
config = ConfigParser.ConfigParse... | StarcoderdataPython |
1781913 | import re
class RegexGenerator():
def __init__(self,string_pattern_to_detect):
self.string_pattern_to_detect = string_pattern_to_detect
self.regex_string = ""
self.create_regex( )
def create_regex(self):
last_index_of_type = -1
current_type = self.determine_char_type(self.string_pattern_to_detect[0]... | StarcoderdataPython |
6636610 | #
# Copyright (c) 2015-2018 Canonical, Ltd.
#
# This file is part of Talisker
# (see http://github.com/canonical-ols/talisker).
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regardin... | StarcoderdataPython |
1787546 | """Transforms on raw wav samples."""
import random
import numpy as np
import librosa
import torch
from torch.utils.data import Dataset
def should_apply_transform(prob=0.5):
"""Transforms are only randomly applied with the given probability."""
return random.random() < prob
class ChangeAmplitude(object):
... | StarcoderdataPython |
3551390 | <gh_stars>1-10
"""
Copyright (c) 2013, <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, this list of conditions an... | StarcoderdataPython |
3201872 | """
.. currentmodule:: feinsum.einsum
.. autoclass:: FusedEinsum
.. autoclass:: VeryLongAxis
.. autoclass:: EinsumAxisAccess
.. autoclass:: FreeAxis
.. autoclass:: SummationAxis
.. autoclass:: Argument
.. autoclass:: EinsumOperand
.. autoclass:: IntermediateResult
.. autoclass:: ContractionSchedule
.. autoclass:: Size... | StarcoderdataPython |
8102282 | <reponame>iamjohnnym/jane
from flask import render_template, flash, redirect, session, url_for
from app import app, db, modules
from models import User
from app.modules.domain.view import mod as domain
from app.modules.database.view import mod as database
from app.modules.user.view import mod as user
from app.modules.s... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.