id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
159452 | <filename>ui_utils.py
#!/usr/bin/env python
from PySide import QtGui
import sys
def catch_error(f):
import functools
@functools.wraps(f)
def catch_unhandled_exceptions(*args, **kwargs):
try:
return f(*args, **kwargs)
except Exception as e:
import traceback
traceback.print_exc()
sys.stderr.flush()
... | StarcoderdataPython |
99932 | from pyimagesearch import datasets
from pyimagesearch import models
from sklearn.model_selection import train_test_split
from keras.layers.core import Dense
from keras.models import Model
from keras.optimizers import Adam
from keras.layers import concatenate
import tensorflow as tf
from tensorflow import feature_column... | StarcoderdataPython |
1722243 | import csv
import logging
import fret
import numpy as np
import torchtext as tt
logger = logging.getLogger(__name__)
class Cutter:
def __init__(self, words, max_len=None, split=' '):
self.words = words
self.max_len = max_len
self.split = split
def __call__(self, s):
words = s... | StarcoderdataPython |
1637099 | #Function min and max sorting etc are only supported for elements of the same type
l = [0,1,2,3,4,5]
print("Min ", min(l))
print("Max", max(l)) | StarcoderdataPython |
4815913 | from modelserver.base.base_predictor import BasePredictor
from visatt.model import ModelSpatial
from visatt.utils import imutils, evaluation
from visatt.config import *
from PIL import Image
import torch
from torchvision import datasets, transforms
import numpy as np
from skimage.transform import resize
def _get_tr... | StarcoderdataPython |
141408 | """
Test suite module for ``XGBoost``.
Credits
-------
::
Authors:
- Diptesh
- Madhu
Date: Sep 27, 2021
"""
# pylint: disable=invalid-name
# pylint: disable=wrong-import-position
import unittest
import warnings
import re
import sys
from inspect import getsourcefile
from os.path import absp... | StarcoderdataPython |
48097 | """
This module is used to generate correlation (R) and regression (b)
coefficients for relationships between the 2015 Census,
2018 Yale Climate Opinion Maps (YCOM) and land area datasets,
as well as p values for these relationships.
"""
import numpy as np
import pandas as pd
from scipy.stats import linregress
def ca... | StarcoderdataPython |
3366013 | <gh_stars>0
from sqlalchemy import Column
from serialchemy import ModelSerializer
def _get_identity(cls):
args = getattr(cls, '__mapper_args__', None)
return args.get('polymorphic_identity') if args is not None else None
def _get_identity_key(cls):
identityColumn = cls.__mapper_args__['polymorphic_on']... | StarcoderdataPython |
3387464 | # todo: write tests, y'know, when you have time (-: | StarcoderdataPython |
4823487 | <reponame>italogsfernandes/emg-moviments-classifier<filename>python-hand-movements-classifier/convert_database_to_new_format.py<gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Coding at 6:48 and listening to:
Rock is Dead - <NAME>
Dance D'Amour - The 69 Eyes
Wake Up - Rage Against the Machi... | StarcoderdataPython |
3274114 | <reponame>DariaMinieieva/sudoku_project<gh_stars>1-10
"""This module visualizes the solved sudoku."""
from copy import deepcopy
import tkinter as tk
import tkinter.font as tkFont
from board import Board
class SudokuDrawer:
"""Class for solving sudoku and visualizing it."""
def __init__(self, boar... | StarcoderdataPython |
132141 | <reponame>zagm/resolwe
# pylint: disable=missing-docstring
from versionfield import VersionField
from django.db import models
from resolwe.flow.models.fields import ResolweSlugField
class TestModel(models.Model):
name = models.CharField(max_length=30)
slug = ResolweSlugField(populate_from='name', unique_w... | StarcoderdataPython |
1705670 | def f(x):
return g(x)
def g(x):
return f(x)
y = f(1)
| StarcoderdataPython |
114943 | import random
import csv
from typing import Iterator, Union, List
from torch.utils.data.sampler import Sampler
import numpy as np
from ..datapaths import DATAPATHS_MAPPING
class LengthTrainSampler(Sampler):
def __init__(
self,
source: str,
field: str,
max_len: float, # 16K * 320... | StarcoderdataPython |
4836974 | from django.urls import path, include
from demo_app import calculator_api
urlpatterns = [
path('add/', calculator_api.add),
]
| StarcoderdataPython |
1784717 | <reponame>Yoann-Vie/esgi-hearthstone<filename>tests/test_runner_apps/tagged/tests.py
from unittest import TestCase
from django.test import tag
@tag('slow')
class TaggedTestCase(TestCase):
@tag('fast')
def test_single_tag(self):
self.assertEqual(1, 1)
@tag('fast', 'core')
def te... | StarcoderdataPython |
3371293 | import sys
sys.path.append("Mask_RCNN")
from mrcnn.model import MaskRCNN
from waldo_config import Waldoconfig
import numpy as np
import skimage.draw
from PIL import Image
if __name__ == '__main__':
config = Waldoconfig(predict=True)
config.display()
model = MaskRCNN(mode="inference", config=config,
... | StarcoderdataPython |
159194 | <filename>utils/plot_metrics.py
""" A script to plot validation metrics produced by the model.
"""
from collections import namedtuple
import numpy as np
import pandas as pd
import plotly.graph_objects as go
_STEPS_PER_ITERATION = 5000
TraceSettings = namedtuple("TraceSettings", ["y", "name", "color"])
def plot_met... | StarcoderdataPython |
3248948 | from typing import List
from ..parser.ast import AST, Node
from ..scanner.tokens import Tokens
from ..semantic import COMPUTATION_NODES, CONSTANT_NODES
class CodeGenerator:
"""
Generates code for the dc language from an AST of the ac language.
"""
def __init__(self, ast: AST):
self.ast = ast
... | StarcoderdataPython |
37381 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
Test pipeline functions in pipeline.py.
"""
# =================================================================... | StarcoderdataPython |
196563 | <filename>cv_drawing_stuff.py
# @Author: <NAME> <varoon>
# @Date: 15-08-2017
# @Filename: cv_drawing_stuff.py
# @Last modified by: varoon
# @Last modified time: 15-08-2017
import numpy
import cv2
image = numpy.zeros((512,512,3),numpy.uint8) #create a black image
cv2.line(image, (384,0),(511,511), (255,0,0),5) ... | StarcoderdataPython |
57337 | <reponame>stanfordnlp/spinn<gh_stars>100-1000
"""From the project root directory (containing data files), this can be run with:
Boolean logic evaluation:
python -m spinn.models.fat_classifier --training_data_path ../bl-data/pbl_train.tsv \
--eval_data_path ../bl-data/pbl_dev.tsv
SST sentiment (Demo only, model... | StarcoderdataPython |
148068 | <reponame>mikkohei13/Loxpyt
import time
import datetime
import json
class report():
def __init__(self, directoryPath):
self._filePath = directoryPath + "_report.html"
self._timeStart = int(time.time())
self._counterPositive = 0
self._counterNegative = 0
html = """<!DOCTYPE html>
<html lang=... | StarcoderdataPython |
3318019 | <gh_stars>1-10
"""
Utility Functions (:mod:`skdh.utility`)
=======================================
.. currentmodule:: skdh.utility
Binary State Fragmentation Endpoints
------------------------------------
.. autosummary:
:toctree: generated/
fragmentation_endpoints.average_duration
fragmentation_endpoin... | StarcoderdataPython |
149581 | # part 1
def check_numbers(a,b):
print (a+b)
check_numbers(2,6)
# part 2
def check_numbers_list(a,b):
i=0
if len(a)==len(b):
while i<len(a):
check_numbers(a[i],b[i])
i +=1
else:
print ("lists ki len barabar nahi hai")
check_numbers_list([10,30,40],[40,20,21])
| StarcoderdataPython |
150813 | <reponame>irom-lab/PAC-BUS
import torch
import numpy as np
from data_generators.omniglot_data import OmniglotNShot
import argparse
import learn2learn as l2l
from models.omniglot_models import SOmniglotModel, OmniglotModel, OmniglotModel1
from learners.reptile_learner import ReptileLearner
argparser = argparse.Argument... | StarcoderdataPython |
3264380 | from django.contrib import admin
from .models import Restaurant, Food, Comment, FoodLike, RestaurantUser
class FoodAdmin(admin.ModelAdmin):
list_display = ('name', 'restaurant', 'image')
search_fields = ('name', 'restaurant__name')
admin.site.register(Restaurant)
admin.site.register(Food, FoodAdmin)
admin.s... | StarcoderdataPython |
1609012 | <reponame>escaped/cookiecutter-jupyter<gh_stars>1-10
import os
from pathlib import Path
if __name__ == '__main__':
project_root = Path(os.path.curdir)
| StarcoderdataPython |
121871 |
def ben_update():
return
def ben_random_tick():
return
| StarcoderdataPython |
8927 | <filename>python/testData/resolve/AssignmentExpressionsAndOuterVar.py<gh_stars>1-10
total = 0
partial_sums = [total := total + v for v in values]
print("Total:", total)
<ref> | StarcoderdataPython |
1644863 | # coding: utf-8
"""
cloudFPGA Resource Manager API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: 0.8
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_i... | StarcoderdataPython |
3253339 | # * -- utf-8 -- * # python3
# Author: Tang Time:2018/4/17
import math
for i in range(100000):
x = int(math.sqrt(i+100))
y = int(math.sqrt(i+268))
if (x*x == i+100) and (y*y ==i+268):
print(i)
'''简述:一个整数,它加上100和加上268后都是一个完全平方数 提问:请问该数是多少?''' | StarcoderdataPython |
3359362 | from django.core.exceptions import ObjectDoesNotExist
from rest_framework import serializers
from integrations.slack.models import SlackConfiguration, SlackEnvironment
from .exceptions import SlackChannelJoinError
from .slack import SlackWrapper
class SlackEnvironmentSerializer(serializers.ModelSerializer):
cla... | StarcoderdataPython |
1762912 | <filename>noogle/gcal.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This module holds the interface to Google calendar.
"""
# Imports #####################################################################
import arrow
from apiclient import discovery
from googleapiclient.errors import HttpError
from .db import se... | StarcoderdataPython |
3200470 |
import os
import sys
import os.path
import logging
import time
import pprint
import shutil
import traceback
import settings
import pArch
import dbPhashApi as dbApi
import scanner.fileHasher
PHASH_DISTANCE_THRESHOLD = 2
BAD_PHASHES = [
# Phash value of '0' is commonly a result of an image where there is no conte... | StarcoderdataPython |
1751685 | # coding: utf8
"""Conll training algorithm"""
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import print_function
import os
import numpy as np
import torch
import torch.nn as nn
import torch.utils.data
class Model(nn.Module):
def __init__(self, vocab_size, embedd... | StarcoderdataPython |
3246407 | #!/usr/bin/env python
import codecs, httplib, json, os, urllib, shutil, subprocess, sys, argparse
upstream_git = 'https://github.com/catapult-project/catapult.git'
script_dir = os.path.dirname(os.path.abspath(sys.argv[0]))
catapult_src_dir = os.path.join(script_dir, 'catapult-upstream')
parser = argparse.ArgumentPa... | StarcoderdataPython |
3395397 | <filename>open_mlstat/google_sheets/sheet_element.py
"""
Element for requesting google sheet
Copyright 2019 <NAME>, <EMAIL>
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, in... | StarcoderdataPython |
93013 | <filename>utility/split_csv.py
''' Split large csv files of online events from a online retail store into
smaller csv files. Also "compressing" the time, which is determined by t_step.
For example, t_step=30 will be 30 times denser, ie. 30 days of data will be packed
into a single day.
'''
import time
from io import St... | StarcoderdataPython |
3252848 | """ This module contains the Video and Movie class and functions. """
import webbrowser
class Video():
def __init__(self, title, duration):
self.title = title
self.duration = (duration)
class Movie(Video): # The main class for movie-trailer website
valid_ratings = ... | StarcoderdataPython |
4830233 | <reponame>smartcar/python-sdk<filename>smartcar/types.py
import datetime
from collections import namedtuple
from typing import List, NamedTuple
import re
import requests.structures as rs
# Return types for Smartcar API.
#
# 'generate_named_tuple' is used to generate an un-typed namedtuple from
# a dictionary. It will... | StarcoderdataPython |
3289722 | <reponame>Sagu12/TextSummarizer
from flask import Flask, render_template,request
import requests
from bs4 import BeautifulSoup
import nltk
import pandas as pd
#https://www.youtube.com/watch?v=h8fE_G9a_Oo
app = Flask(__name__)
def get_wiki_content(url):
req_obj = requests.get(url)
text = req_obj.... | StarcoderdataPython |
3269185 | <gh_stars>1-10
import __clrclasses__.System.Management.Instrumentation as Instrumentation
| StarcoderdataPython |
108247 | """
SQ数据集数据文件目录
文件获取举例:inner2['29'][2],
得到的是内圈2下29Hz的第2个文件(actually 3rd),
默认文件夹内排列顺序,每一个转速下共有3个文件[0~2]
train_dir109 1-故障程度 09-转速(Hz)
train 均使用第0个数据文件,test均使用第1个数据文件
"""
# home = r'G:\dataset\SQdata' # U盘
home = r'F:\dataset\SQdata' # 本地F盘
inner1 = {'09': [home + r'\inner1\09\REC3585_ch2.txt', home + r'\inner1\09\REC... | StarcoderdataPython |
3256421 | <reponame>SunliangzeSmile/smilexls
#!/usr/bin/env python3
#-*-coding:utf-8-*-
# /* *
# @Author: sunliangzesmile
# @Date: 2019-09-28 18:28:16
# @Last Modified by: sunliangzesmile
# @Last Modified time: 2019-09-28 18:28:16
# @Description:
#* */
from config import app_config
from flask import Flask,request,u... | StarcoderdataPython |
1607620 | <gh_stars>0
# autostart localizer
from __future__ import print_function
import sys, os, time
import rospy
import rosnode
import tf
from nav_msgs.msg import Odometry
TOPIC_GROUND_TRUTH = '/base_pose_ground_truth'
def get_ROS_nodes():
nodes = None
try:
nodes = rosnode.get_node_names()
except Exce... | StarcoderdataPython |
1678592 | <filename>embeds/migrations/0001_initial.py<gh_stars>0
# Generated by Django 3.2.9 on 2021-11-10 11:24
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappab... | StarcoderdataPython |
119717 | <gh_stars>10-100
from asyncio import create_task, sleep, Task
from collections import Counter
from datetime import datetime as dt, timedelta as td
from itertools import chain
from typing import Dict, List, Optional, Sequence, Tuple, TypeVar
from discord import abc, Embed, TextChannel, Message, Reaction, User
from .ut... | StarcoderdataPython |
4821283 | # Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
# model file: example-models/ARM/Ch.4/kidscore_momwork.stan
import torch
import pyro
import pyro.distributions as dist
def init_vector(name, dims=None):
return pyro.sample(name, dist.Normal(torch.zeros(dims), 0.2 * torch.ones(dims... | StarcoderdataPython |
1672359 | <gh_stars>1-10
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name='steam-review-scraper',
version='0.1.0',
author='<NAME>',
author_email='<EMAIL>',
description='A package to scrape game reviews from Steam.',
keywords=['steam', 'review',... | StarcoderdataPython |
3229333 | <reponame>ipeterov/convenient-rpc<filename>task_server/test.py
import unittest
from lib.tasks import *
manager = TaskManager()
class TestManager(unittest.TestCase):
def test_estimate_runtime(self):
import random
task = {
'package': 1,
'version': 2,
'function'... | StarcoderdataPython |
171436 | # -*- coding: utf-8 -*-
#
# Copyright 2012-2015 BigML
#
# 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 ... | StarcoderdataPython |
43888 | from django.urls import include, path
from rest_framework.routers import DefaultRouter
from rooms import views
# Create a router and register our viewsets with it.
router = DefaultRouter()
router.register(r"room", views.RoomViewSet, basename="room")
# The API URLs are now determined automatically by the router.
urlp... | StarcoderdataPython |
3351328 | <filename>conans/test/generators/json_test.py<gh_stars>0
import json
import unittest
import os
from conans.client.generators.json_generator import JsonGenerator
from conans.model.settings import Settings
from conans.model.conan_file import ConanFile
from conans.model.build_info import CppInfo
from conans.model.ref imp... | StarcoderdataPython |
153801 | import pickle
from PIL import Image
import numpy as np
from dlib import cnn_face_detection_model_v1
from controller import Camera
from flockai.PyCatascopia.Metrics import *
from flockai.interfaces.flockai_ml import FlockAIClassifier
from flockai.models.probes.flockai_probe import FlockAIProbe, ProcessCpuUtilizationMet... | StarcoderdataPython |
113176 | from ..gui.main_window import Ui_EditorMainWindow
from PySide.QtGui import QApplication, QMainWindow, QPixmap
from PySide import QtGui, QtCore
from PySide.QtCore import QObject
import sys
import numpy as np
from .. import util
from .brush_dialog import BrushDialog
from .about_dialog import AboutDialog
from .new_image_d... | StarcoderdataPython |
3218102 | """
A custom manager for working with trees of objects.
"""
from __future__ import unicode_literals
import functools
import contextlib
from itertools import groupby
from django.db import models, connections, router
from django.db.models import F, ManyToManyField, Max, Q
from django.utils.translation import ugettext as... | StarcoderdataPython |
4819460 | # Copyright (c) <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
# 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 us... | StarcoderdataPython |
4815310 | import cv2
import numpy as np
# Utility function to draw points in a quadrilateral polygon
def quadrilateral_points(input_image, vertices):
output_image = np.copy(input_image)
color = [0, 0, 255] # Red
thickness = 2
radius = 3
x0, y0 = vertices[0]
x1, y1 = vertices[1]
x2, y2 = vertices[2]... | StarcoderdataPython |
1702474 | # Copyright 2012 OpenStack Foundation
# Copyright 2015 Metaswitch Networks
# 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/li... | StarcoderdataPython |
1639294 | from setuptools import setup, PEP420PackageFinder
setup(
name="illd",
version="0.0.1",
packages=PEP420PackageFinder.find("src"),
package_data={},
package_dir={"": "src"},
extras_require={
"testing": ["hypothesis", "pytest", "pytest-mock"],
"documentation": ["sphinx", "sphinx_rtd... | StarcoderdataPython |
3374287 | import time
class Game(object):
"""井字游戏"""
def __init__(self):
# 实例化类便开始初始化游戏
self.initialize_game()
# 初始化棋盘
def initialize_game(self):
self.current_state = [['.','.','.'],
['.','.','.'],
['.','.','.']]
# 玩家X用X作... | StarcoderdataPython |
9498 | <filename>src/sage/tests/books/computational-mathematics-with-sagemath/domaines_doctest.py<gh_stars>1000+
## -*- encoding: utf-8 -*-
"""
This file (./domaines_doctest.sage) was *autogenerated* from ./domaines.tex,
with sagetex.sty version 2011/05/27 v2.3.1.
It contains the contents of all the sageexample environments f... | StarcoderdataPython |
1738105 | import simplejson as json
from mongrel2 import handler
import hashlib
import base64
sender_id = "82209006-86FF-4982-B5EA-D1E29E55D481"
conn = handler.Connection(sender_id, "tcp://127.0.0.1:9999",
"tcp://127.0.0.1:9998")
users = {}
user_list = []
def wsChallenge(v):
try:
x=hashl... | StarcoderdataPython |
67475 | import gym
import hydra
from ood_env import OODEnv
from util import ImageInputWrapper
import numpy as np
from stable_baselines3.common.vec_env.vec_frame_stack import VecFrameStack
from stable_baselines3.common.vec_env import DummyVecEnv
from stable_baselines3.common.monitor import Monitor
from stable_baselines3.common... | StarcoderdataPython |
1663536 | import urllib2
import requests
from bs4 import BeautifulSoup
def getEricAuth():
login_url = "http://scumbag-control/auth.asp"
target_url = "http://scumbag-control/title_app.asp"
login_params = {'login' : 'administrator', 'password' : '<PASSWORD>', 'action_login.x' : '1', 'action_login.y' : '1'}
s = requests.Sess... | StarcoderdataPython |
191002 | <reponame>triffid/kiki
# .................................................................................................................
level_dict["bronze"] = {
"scheme": "bronze_scheme",
"size": (9,6,9),
"intro": "bronze",
... | StarcoderdataPython |
1768363 | <reponame>danielpatrickdotdev/beerfest
# Generated by Django 2.1.2 on 2018-10-26 07:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('beerfest', '0003_auto_20181019_0438'),
]
operations = [
migrations.AlterField(
model_name... | StarcoderdataPython |
3255710 | # Emulate runserver...
from django.core.management.commands.runserver import *
# ... and monkey-patch it!
from django.core.management.commands import runserver
from c10ktools.servers.tulip import run
runserver.run = run
del runserver
| StarcoderdataPython |
1778353 | <gh_stars>0
'''
@Autor: <NAME>
@Email: <EMAIL>
@Description: Agrupar aquellas palabras que tengan el mismo anaggrama
'''
def groupAnagrams(strs):
# el metodo sorted ordena y devuelve una cadena,
# mediante join agrupomos la palabras en una cadena vacia
diccionarioWord = {}; # diccionario
for i in strs... | StarcoderdataPython |
1788948 | <filename>posts/admin.py
from django.contrib import admin
from posts.models import Post,Comment
admin.site.register(Comment)
admin.site.register(Post)
| StarcoderdataPython |
1609847 | <gh_stars>1000+
#!/usr/bin/env python
try:
from yaml import (
CLoader as Loader,
CSafeLoader as SafeLoader,
CDumper as Dumper
)
except ImportError:
from yaml import (
Loader, SafeLoader, Dumper
)
if Loader.__name__ == 'CLoader':
print("libyaml is working")
elif Loade... | StarcoderdataPython |
3252419 | DATES_NUMBER: int = 7
INITIAL_SHIFT: int = -1
MOVEMENT_SHIFT: int = 7
| StarcoderdataPython |
3372158 | # Generated by Django 3.1.12 on 2021-07-15 00:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('reo', '0114_sitemodel_lifetime_emissions_cost_co2'),
]
operations = [
migrations.AddField(
model_name='scenariomodel',
... | StarcoderdataPython |
51861 | from bytewax import Dataflow, run
flow = Dataflow()
flow.map(lambda x: x * x)
flow.capture()
if __name__ == "__main__":
for epoch, y in sorted(run(flow, enumerate(range(10)))):
print(y)
| StarcoderdataPython |
1681189 | import glob
import os
files = glob.glob("../output/Financial Data/*.csv")
codeFile = "../output/StockCodesNYSE.csv"
def detect_empty(file):
data = open(file,'r').read()
lines = data.split('\n')
for line in lines:
fields = line.split('|')
if len(fields)>1:
return False
return True
def check_count():
... | StarcoderdataPython |
1621111 | # Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# This file is 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/
#
# This file is d... | StarcoderdataPython |
1640317 | from rest_framework import serializers
from operations.models import Operation
class OperationSerializer(serializers.ModelSerializer):
class Meta:
model = Operation
fields = ('id', 'data') | StarcoderdataPython |
70310 | import os
import copy
import json
def get_all_files(root, ext=None):
result = []
for (new_path, dirs, files) in os.walk(root):
result += [ os.path.abspath(os.path.join(new_path, f)) for f in files if ext is None or os.path.splitext(f)[1] == ext]
return result
def obj_to_deep_dict(obj, classkey=Non... | StarcoderdataPython |
3266113 | #!/usr/bin/env python3
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.model_selection import KFold
from sklearn.metrics import accuracy_score
from sklearn.neighbors import KNeighborsClassifier
from sklearn.tree import DecisionTreeClassifier
from sklearn.neural_n... | StarcoderdataPython |
3224733 | #!/usr/bin/env python
'''
Unit tests for inventory/environ.py
'''
from __future__ import absolute_import
import os
import sys
import pytest
from mock import MagicMock, patch, mock_open
FILE_DIR = os.path.dirname(os.path.realpath(__file__))
#FIXTURES_DIR = os.path.join(FILE_DIR, "fixtures")
REPO_DIR = os.path.join(FIL... | StarcoderdataPython |
3262927 | # pyOCD debugger
# Copyright (c) 2022 Huada Semiconductor Corporation
# Copyright (c) 2022 <NAME>
# SPDX-License-Identifier: Apache-2.0
#
# 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
#
# ... | StarcoderdataPython |
1768750 | <gh_stars>0
# -*- coding: utf-8 -*-
# speechrate.py - determines the speech rate of data from the Buckeye corpus.
#
# Copyright 2019, <NAME> (<EMAIL>)
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributi... | StarcoderdataPython |
143906 | <reponame>argriffing/matplotlib
#!/usr/bin/env python
import numpy as np
import matplotlib.cm as cm
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
delta = 0.025
x = y = np.arange(-3.0, 3.0, delta)
X, Y = np.meshgrid(x, y)
Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
Z2 = mlab.bivariate_normal(X... | StarcoderdataPython |
1637424 | import pymath
disp = float(input())
time = float(input())
print("velocity = {}".format(pymath.physics.velocity(disp, time)))
| StarcoderdataPython |
166713 | <gh_stars>0
import fst
import codecs
import sys
import cPickle as pickle
import subprocess
from kitchen.text.converters import getwriter
DATA_DIR = sys.argv[1]
FILE_LIST = sys.argv[2]
DUTCH_FST_FILE = '/export/ws15-pt-data/rsloan/Dutch_ref_orthography_fst.txt'
DUTCH_DICT = '/export/ws15-pt-data/rsloan/dt_pron.p'
EN_DI... | StarcoderdataPython |
74170 | <reponame>QwaddleMan/XNATSlicer
__author__ = "<NAME> (<EMAIL>)"
__copyright__ = "Copyright 2014, Washington University in St. Louis"
__credits__ = ["<NAME>", "<NAME>", "<NAME>"]
__license__ = "XNAT Software License Agreement " + \
"(see: http://xnat.org/about/license.php)"
__version__ = "2.1.1"
__maintain... | StarcoderdataPython |
147179 | <filename>qa/rpc-tests/elysium_property_creation_fee.py
#!/usr/bin/env python3
from test_framework.authproxy import JSONRPCException
from test_framework.test_framework import ElysiumTestFramework
from test_framework.util import assert_raises_message
class ElysiumPropertyCreationFeeTest(ElysiumTestFramework):
def ... | StarcoderdataPython |
3246360 | #-*- coding: utf-8 -*-
from django.conf.urls.defaults import patterns, include, url
from shop.models.productmodel import Product
from shop.views import ShopListView, ShopTemplateView
from shop.views.cart import CartDetails, CartItemDetail
from shop.views.checkout import ThankYouView, CheckoutSelectionView, \
Shippi... | StarcoderdataPython |
115848 | <filename>python-scripts/gt_path_manager.py
"""
GT Path Manager - A script for quickly repathing many elements in Maya.
<NAME> - <EMAIL> - 2020-08-26 - github.com/TrevisanGMW
0.1a - 2020-08-26
Created initial setup, added table and icons for file nodes
1.0 - 2020-12-02
Initial Release
Added support ... | StarcoderdataPython |
91295 | <reponame>fakela/mindee-api-python
import pytest
from mindee import Client, Response, Receipt, Passport
from mindee.http import HTTPException
@pytest.fixture
def empty_client():
return Client()
@pytest.fixture
def dummy_client():
return Client(
expense_receipt_token="dummy",
invoice_token="<... | StarcoderdataPython |
1790279 | <reponame>voocel/wechat
import itchat
import time
import datetime
def timer_handle(exec_time):
flag = 0
while True:
now = datetime.datetime.now()
if now > exec_time and now < exec_time + datetime.timedelta(seconds = 1):
send_to()
time.sleep(1)
flag = 1
... | StarcoderdataPython |
4040 | <reponame>RobotLocomotion/drake-python3.7
import numpy as np
from pydrake.common.value import AbstractValue
from pydrake.math import RigidTransform
from pydrake.perception import BaseField, Fields, PointCloud
from pydrake.systems.framework import LeafSystem
def _TransformPoints(points_Ci, X_CiSi):
# Make homogen... | StarcoderdataPython |
1615049 | <filename>gazoo_device/primary_devices/esp32_matter_locking.py
# Copyright 2021 Google LLC
#
# 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
... | StarcoderdataPython |
131099 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
from torchvision import datasets, models, transforms
class STN3D(nn.Module):
def __init__(self, input_channels=3):
super(STN3D, self).__init__()
self.input_channels = input_channels
self.mlp1 = nn.Sequenti... | StarcoderdataPython |
1773945 | from typing import Iterable, Iterator, List, Optional, Tuple
from pypict import capi
class Task:
def __init__(self, seed: Optional[int] = None):
self.handle = capi.createTask()
self._model = _Model(seed)
capi.setRootModel(self.handle, self._model.handle)
def __del__(self) -> None:
... | StarcoderdataPython |
154954 | <gh_stars>0
# Copyright (c) 2019 <NAME>.
# Cura is released under the terms of the LGPLv3 or higher.
from typing import Any, Dict, TYPE_CHECKING
from . import VersionUpgrade43to44
if TYPE_CHECKING:
from UM.Application import Application
upgrade = VersionUpgrade43to44.VersionUpgrade43to44()
def getMetaData() ... | StarcoderdataPython |
3353362 | import os
import operator
import json
import requests
import graphql_queries
PATH_TO_DATA = "_data"
GITHUB_USERNAME = os.environ["GH_USERNAME"]
GITHUB_OAUTH_TOKEN = os.environ["OAUTH_TOKEN"]
GITHUB_API_ENDPOINT = "https://api.github.com/graphql"
print("LOG: Assuming the current path to be the root of the metrics rep... | StarcoderdataPython |
4839416 | <reponame>fjsaezm/mcd-maaa<gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: <NAME>
Color changes made by: <NAME>
"""
import numpy as np
from sklearn.metrics import mean_squared_error, mean_absolute_error, r2_score, accuracy_score
from matplotlib import pyplot as plt, colors, lines
from sklearn... | StarcoderdataPython |
4817482 | # -*- coding:utf-8 -*-
"""
Copyright (c) 2013-2016 SYPH, All Rights Reserved.
-----------------------------------------------------------
Author: S.JunPeng
Date: 2016/12/22
Change Activity:
_==/ i i \==_
/XX/ |\___/| \XX\
/XXXX\ ... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.