id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
77419 | # -*- coding: utf-8 -*-
"""
Created on Tue Oct 6 15:37:07 2020
@author: aoust
"""
import numpy as np
import math
class QuadraticPolynomial():
def __init__(self,n,tuples, coefs):
self.n = n
assert(len(tuples)==len(coefs))
self.tuples = tuples
self.coefs = coefs
... | StarcoderdataPython |
3398058 | <reponame>patriotemeritus/LO-PHI
#!/usr/bin/env python
""""
LOPHI Actuation Library
@TODO: add mouse support
Script syntax:
SPECIAL: <LEFT_GUI> n
TEXT: wget ftp://get_test_malware_here
MOUSE: (TODO)
SLEEP: (Time in seconds)
Each line is a command message
Header is ne... | StarcoderdataPython |
1605854 | PART_V = 'xc7k410tfbg900-1'
PART_N = 'NG-MEDIUM'
@runner(NanoXplore, single_thread=True)
def nx_math_runner():
for n in (8, 16, 32, 64, 128, 256):
yield dict(name='add%d' % n, part=PART_N, files=('../vhdl/add_nx.vhd',), generics={'N': n}, path=NX_PATH)
@runner(Vivado)
def vivado_math_runner():
for n... | StarcoderdataPython |
3244855 | import matplotlib.pyplot as plt
import pandas as pd
import pytask
import seaborn as sns
from src.config import BLD
_PARAMETRIZATION = [
(
BLD / "contact_models" / "age_assort_params" / "other_non_recurrent.pkl",
"assortative_matching_other_non_recurrent_age_group",
BLD / "figures" / "data"... | StarcoderdataPython |
178877 | <reponame>karolinanikolova/SoftUni-Software-Engineering
# 3. Сума от числа
# Напишете програма, която чете цяло число от конзолата и на всеки следващ ред цели числа, докато тяхната сума стане
# по-голяма или равна на първоначалното число. След приключване на четенето да се отпечата сумата на въведените числа.
number =... | StarcoderdataPython |
28573 | <gh_stars>0
import torch
import tvm
from tvm import autotvm
from tvm import relay
from tvm.contrib import download
from tvm.contrib.debugger import debug_runtime
from PIL import Image
import matplotlib.pyplot as plt
import numpy as np
import argparse
import os
from os.path import join, isfile
import sys
import json, ... | StarcoderdataPython |
44478 | <gh_stars>0
#!/usr/bin/env python
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import print_function
import difflib
import logging
import os
import re
import textwrap
def ProcessIncl... | StarcoderdataPython |
3283717 | import objc
import sys
from Foundation import *
from AppKit import *
from PyObjCTools import NibClassBuilder, AppHelper
import pyRotateDisplayAPIMac as dispAPI
import pyRotateDisplaySettingsMac as settingsWindow
import pyRotateDisplayArduinoAPI as arduinoAPI
import pyRotateDisplayStatusBar as statusBar
if __name__ ==... | StarcoderdataPython |
3368680 | <reponame>oskar456/spotzurnal
import os
import os.path
import json
import spotipy
from spotipy import oauth2
import click
def handle_oauth(credfile, username=None, scope=""):
save_creds = False
try:
with open(credfile) as f:
creds = json.load(f)
except IOError:
creds = {}
... | StarcoderdataPython |
3329055 | <gh_stars>10-100
# Copyright 2020 IBM Corporation
#
# 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 agree... | StarcoderdataPython |
1636202 | import serial
import matplotlib.pyplot as plt
import time
import statistics
moment = time.strftime("%Y-%b-%d__%Hh%Mm%Ss",time.localtime())
rawdata = []
count = 0
fileName = 'data_' + moment +'.txt'
#the time that the program will be running in seconds 16 min ish
timeOut = 1000
#connect to the arduino
try:
ard = seri... | StarcoderdataPython |
1676029 | #!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | StarcoderdataPython |
3210586 | <filename>lib/diffmask/__init__.py
#!/usr/bin/python
# vim:fileencoding=utf-8
# (C) 2010 <NAME>, distributed under the terms of 3-clause BSD license
PV='0.3.3'
| StarcoderdataPython |
3242947 | import os
import torch
import numpy as np
from config import get_config
from src.Learner import face_learner
import argparse
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='')
parser.add_argument("-m", "--load_model", default="", type=str)
args = parser.parse_args()
conf = g... | StarcoderdataPython |
3353457 | <gh_stars>0
# coding: utf-8
#
# Copyright 2020 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... | StarcoderdataPython |
1714916 | <reponame>sgk98/travelling_salesman
import random
import pickle
import math
import nn
def probability(old,new,T):
if new<old:
return 1.0
else:
#return 0.0
return math.exp(- abs(old-new)/T)
def get_rand(n):
init=[i for i in range(1,n)]
random.shuffle(init)
init=[0]+init+[... | StarcoderdataPython |
1646742 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2018-01-13 13:47
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('account', '0014_auto_20180107_1224'),
]
operations = [
migrations.RemoveField(
... | StarcoderdataPython |
3304647 | <gh_stars>1-10
'''
NOTE!!
Remember to include Oracle instaclient in PATH:
set PATH=%PATH%;C:\oracle\instantclient_18_3
'''
import sys
from pathlib import Path
import click
import cx_Oracle
from db_connect import (usr, pwd, server, service, port)
BASE = Path(__file__).parents[0]
REFNR_FILE = BASE / Path('ref... | StarcoderdataPython |
147219 | # -*- coding: utf-8 -*-
# flake8: noqa: F401
# noreorder
"""
Pytube: a very serious Python library for downloading YouTube Videos.
"""
__title__ = "pytube3"
__author__ = "<NAME>, <NAME>"
__license__ = "MIT License"
__copyright__ = "Copyright 2019 <NAME>"
from pytube.version import __version__
from pytube.streams impor... | StarcoderdataPython |
3228973 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.shortcuts import redirect
class AuthRedirectMixin(object):
def get(self, request, *args, **kwargs):
if request.user.is_authenticated():
return redirect('/')
else:
return super(AuthRedirectMixin, self).ge... | StarcoderdataPython |
164809 | <reponame>stevepbyrne/dbus-systemcalc-py
import os
import sys
# Modify path so we can find our own packages
test_dir = os.path.dirname(__file__)
sys.path.insert(0, test_dir)
sys.path.insert(1, os.path.join(test_dir, '..', 'ext', 'velib_python', 'test'))
sys.path.insert(1, os.path.join(test_dir, '..', 'ext', 'velib_pyt... | StarcoderdataPython |
3389844 | <reponame>finswimmer/clikit<filename>tests/handler/help/test_help_text_handler.py<gh_stars>10-100
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import pytest
from clikit.api.args import Args
from clikit.args.string_args import StringArgs
from clikit.config.default_application_config import DefaultAp... | StarcoderdataPython |
3357103 | <filename>hutch_python/cache.py
"""
This module is responsible for accumulating all loaded objects and making sure
they are available in the ``xxx.db`` virtual module. It is used extensively in
`load_conf.load_conf`.
"""
from importlib import import_module
from pathlib import Path
import datetime
import logging
import ... | StarcoderdataPython |
1795598 | <reponame>bashu/sigmacms-fluent-pages
from optparse import make_option
from django.conf import settings
from django.contrib.sites.models import Site
from django.core.management.base import BaseCommand, CommandError, NoArgsCommand
from django.utils import translation
from django.utils.translation import get_language_inf... | StarcoderdataPython |
3232575 | import sys
import pandas as pd
# From Assignment 2, copied manually here just to remind you
# that you can copy stuff manually if importing isn't working out.
# You can just use this or you can replace it with your function.
def countTokens(text):
token_counts = {}
tokens = text.split(' ')
for word in to... | StarcoderdataPython |
1795191 | <reponame>bhardwajRahul/web3.py
import pytest
from eth_abi.exceptions import (
ValueOutOfBounds,
)
from hypothesis import (
given,
strategies as st,
)
from web3._utils.events import (
DataArgumentFilter,
TopicArgumentFilter,
normalize_topic_list,
)
@pytest.mark.parametrize(
"topic_list,e... | StarcoderdataPython |
3231406 | <gh_stars>1-10
import argparse
import logging
import pickle
import minato
from automlcli.commands.subcommand import Subcommand
from automlcli.models import Model
logger = logging.getLogger(__name__)
@Subcommand.register(
name="retrain",
description="retrain model with new data",
help="retrain model wit... | StarcoderdataPython |
1709323 | # ===========================================================
# ========================= imports =========================
import sys
import datetime
from gnsspy.funcs.funcs import (gpsweekday, datetime2doy)
from gnsspy.doc.IGS import IGS, is_IGS
# ===========================================================
d... | StarcoderdataPython |
1647146 | <reponame>CedricTravelletti/MESLAS<filename>meslas/covariance/heterotopic.py
""" Code for multidimensional sampling.
We will be considering multivariate random fields Z=(Z^1, ..., Z^p).
The term *response index* denotes the index of the component of the field we
ate considering.
We will sometime use the word measureme... | StarcoderdataPython |
1734451 | translate_table = {'a':'b',
'c':'d'
}
s = raw_input('String please: ')
s.translate(translate_table)
| StarcoderdataPython |
7030 | # coding: utf-8
import functools
def memoize(fn):
known = dict()
@functools.wraps(fn)
def memoizer(*args):
if args not in known:
known[args] = fn(*args)
return known[args]
return memoizer
@memoize
def nsum(n):
'''返回前n个数字的和'''
assert(n >= 0), 'n must be >= 0'
... | StarcoderdataPython |
1694532 | <reponame>arbonagw/AstralShipwright<filename>Scripts/UploadSteamDemo.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#-------------------------------------------------------------------------------
# Upload a demo for distribution on Steam, see UploadSteam.py for details
#
# <NAME> 2022
#---------------------... | StarcoderdataPython |
4801763 | from helper import unittest, PillowTestCase, hopper
from PIL import Image
import os
class TestImageLoad(PillowTestCase):
def test_sanity(self):
im = hopper()
pix = im.load()
self.assertEqual(pix[0, 0], (20, 20, 70))
def test_close(self):
im = Image.open("Tests/images/hop... | StarcoderdataPython |
3352748 | from tempfile import NamedTemporaryFile
import pytest
from testapp.models import Attachment
from djantic import ModelSchema
@pytest.mark.django_db
def test_image_field_schema():
class AttachmentSchema(ModelSchema):
class Config:
model = Attachment
image_file = NamedTemporaryFile(suffix=... | StarcoderdataPython |
142833 | <reponame>cron-ooo/django-compressor
from django.core.exceptions import ImproperlyConfigured
from django.utils.encoding import smart_str
from django.utils.functional import cached_property
from compressor.exceptions import ParserError
from compressor.parser import ParserBase
class LxmlParser(ParserBase):
"""
... | StarcoderdataPython |
4806057 | <reponame>craigahobbs/sunrise<filename>sunrise.py
# Licensed under the MIT License
# https://github.com/craigahobbs/sunrise/blob/main/LICENSE
import argparse
import csv
from datetime import datetime, timedelta, timezone
import sys
import ephem
import pytz
# The list of cities for which to generate sunrise data
CITI... | StarcoderdataPython |
1693004 | # -*- coding: utf-8 -*-
"""
@author: WZM
@time: 2021/1/2 17:52
@function: 测试模型精度
"""
from net.ouy_net import Network
import numpy as np
import torch
import os
def load_net(fname, net):
import h5py
h5f = h5py.File(fname, mode='r')
for k, v in net.state_dict().items():
param = torch.from_numpy(np.... | StarcoderdataPython |
3209547 | import warnings
warnings.filterwarnings('ignore', category=FutureWarning)
from flask import abort, render_template, Flask
import logging
import db
APP = Flask(__name__)
# Start page
@APP.route('/')
def index():
stats = {}
x = db.execute('SELECT COUNT(*) AS movies FROM MOVIE').fetchone()
stats.update(x)
... | StarcoderdataPython |
1676268 | <filename>examples/cv/mnist_lenet5_image_classification_pure_lightning.py
# Copyright (c) 2020, NVIDIA CORPORATION. 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
#
# ... | StarcoderdataPython |
3360899 | <gh_stars>0
'''
DESKRIPSI SOAL
Koko membuat N buah tumpukan kayu yang bertempat di sebuah wadah. Kemudian, dia
memiringkan wadah tersebut ke kanan. Karena dimiringkan tersebut, bisa jadi
banyak kayu yang bergeser ke kanan.
Misalkan awalnya Koko mempunyai 4 buah tumpukan, dengan tinggi 3, 2, 1, 2.
Setelah dimiringkan... | StarcoderdataPython |
3344783 | <reponame>freedge/fake-switches
# Copyright 2015-2016 Internap.
#
# 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 appli... | StarcoderdataPython |
3270606 | <reponame>papsebestyen/sscutils
from dataclasses import dataclass
from typing import List
import sqlalchemy as sa
from ...primitive_types import PrimitiveType, get_np_type, get_sa_type
@dataclass
class Column:
name: str
dtype: PrimitiveType
nullable: bool = False
def to_sql_col(col: Column):
retur... | StarcoderdataPython |
159439 | <gh_stars>0
from django import forms
from django.contrib import admin, messages
from django.urls import path
from .models import VolunteerCategory, Request, CategoryType, Role
from django.shortcuts import render, redirect
import datetime
from django.http import HttpResponse
import csv
from backend.settings import TIME_... | StarcoderdataPython |
1747098 | <filename>telethon/tl/custom/conversation.py
import asyncio
import functools
import inspect
import itertools
import time
from .chatgetter import ChatGetter
from ... import helpers, utils, errors
# Sometimes the edits arrive very fast (within the same second).
# In that case we add a small delta so that the age is old... | StarcoderdataPython |
1600960 | <reponame>jonzxz/project-piscator
## Application Objects
from app import db, encryption_engine
## Utilities
from datetime import datetime
# Defines model for EmailAddress class
class EmailAddress(db.Model):
__tablename__ = 'email_address'
email_id = db.Column(db.Integer, primary_key=True)
email_address = ... | StarcoderdataPython |
1712450 | <gh_stars>0
from pyapp.conf import settings
# Ensure settings are configured
settings.configure(["pyapp_ext.pyspark.default_settings"])
| StarcoderdataPython |
1717947 | <filename>app/hold/urls.py
from django.conf.urls import patterns, url
from app.hold import views
urlpatterns = patterns('',
url(r'index/$', views.index, name='index'),
url(r'detail/(?P<fund_id>\d+)/$', views.detail, name='detail'),
url(r'get_hold/(?P<fund_id>\d+)/$', views.get_hold, name='get_hold'),
)
| StarcoderdataPython |
113129 | import argparse
import glob
import os
import random
import logging
import numpy as np
import math
from tqdm import tqdm
import time
import torch
from transformers import AutoTokenizer, AutoModelForMaskedLM
from transformers import DataCollatorForLanguageModeling
from transformers.optimization import AdamW, get_linear_s... | StarcoderdataPython |
4800021 | <gh_stars>1-10
# encoding: utf-8
"""
@author: liyao
@contact: <EMAIL>
@software: pycharm
@time: 2020/6/12 1:39 下午
@desc:
"""
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="feishu-sdk",
version="1.0.2",
author="liyao",
author_email="<EMAIL... | StarcoderdataPython |
51908 | <gh_stars>0
def no_boring_zeros(n):
return int(str(n).strip("0")) if n != 0 else n | StarcoderdataPython |
3205886 | <reponame>KHanghoj/epiPALEOMIX<gh_stars>1-10
#!/usr/bin/python
#
# Copyright (c) 2012 <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... | StarcoderdataPython |
3300785 | from typing import Any, Callable, TypeVar, Union
from ..includes import includes
from ..map import map
from ..reduce import reduce
T = TypeVar('T', bound='List')
class List(list):
def map(self: T, cb) -> T:
return List(map(self, cb))
def reduce(self: T, cb, initializer=None) -> Union[str, int, floa... | StarcoderdataPython |
62547 | import sys
import os
import numpy as np
from pprint import pprint
from datetime import datetime
from datetime import timedelta
import mysql.connector
import math
import matplotlib.pyplot as plt
import matplotlib.colors
from matplotlib import dates
from mpl_toolkits.basemap import Basemap
import calendar
from scipy.opti... | StarcoderdataPython |
3332813 | <reponame>fostroll/toxine<gh_stars>1-10
# -*- coding: utf-8 -*-
# Toxine project
#
# Copyright (C) 2019-present by <NAME>
# License: BSD, see LICENSE for details
"""
Toxine is a part of the RuMor project. It is a pipeline of the text
preprocessing, preliminary entity tagging, and tokenization.
"""
from toxine._version ... | StarcoderdataPython |
3240368 | <reponame>uniphil/feedwerk
import io
from setuptools import find_packages, setup
with io.open('README.md', 'rt', encoding='utf8') as f:
readme = f.read()
setup(
name="feedwerk",
version="1.0.0",
url="https://github.com/uniphil/feedwerk",
project_urls={
"Documentation": "https://github.co... | StarcoderdataPython |
1707692 | <gh_stars>10-100
""" NXOS-specific utilities. """
import re
from unicon.plugins.generic import GenericUtils
from unicon.utils import AttributeDict
class NxosUtils(GenericUtils):
def get_redundancy_details(self, connection, timeout=None, who='my'):
"""
:arg connection: device connection object
... | StarcoderdataPython |
1779723 | <gh_stars>1-10
#!/usr/bin/env/python3
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
"""Events API
**Overview**:
The event API is used to publish and process... | StarcoderdataPython |
3352467 | <reponame>xksteven/ethics_amti<filename>examples/expert_val_justice/create_tasks.py
# simple task generator double check the max Assignments
import argparse
import numpy as np
import pandas as pd
import json
from sklearn.utils import shuffle
parser = argparse.ArgumentParser(description='Create tasks to validate.')
par... | StarcoderdataPython |
124582 | ################################################################
# compareTools.py
#
# Defines how nodes and edges are compared.
# Usable by other packages such as smallGraph
#
# Author: <NAME>, Oct. 2013
# Copyright (c) 2013-2014 <NAME> and <NAME>
################################################################
def g... | StarcoderdataPython |
1731261 | from kokoropy import request, draw_matplotlib_figure, Autoroute_Controller, \
load_view
class My_Controller(Autoroute_Controller):
'''
Plotting example
'''
def action_plot(self):
max_range = 6.28
if 'range' in request.GET:
max_range = float(request.GET['range'])
... | StarcoderdataPython |
3253164 | import pandas as pd
from sklearn.impute import KNNImputer
path = "/Users/joshuaelms/Desktop/github_repos/CSCI-B365/Meteorology_Modeling_Project/data/pretty_data.csv"
df = pd.read_csv(path)
df_knn = KNNImputer().fit_transform(df)
df_knn_actual = pd.DataFrame(df_knn)
df_knn_actual.columns = df.columns
write_path = "/U... | StarcoderdataPython |
1711219 | <reponame>ShacharWeis/Pi-Thermal-Printer-Camera
import atexit
import cPickle as pickle
import errno
import fnmatch
import io
import os
import os.path
import picamera
import pygame
import stat
import threading
import time
import yuv2rgb
from pygame.locals import *
from subprocess import call
import traceback
import sy... | StarcoderdataPython |
1642830 | #!/tools/lm-venv/py3.6-tf-1.3.0-svail/bin/python
import click
import math
import os
import sys
import config
import shutil
import itertools
import numpy as np
from parallelism import Parallelism
from topology import Topology
from simulate import Graph
import util
from hw_component import Core, MemoryHierarchy, Networ... | StarcoderdataPython |
1714150 | <filename>make.py
#!python
# coding: utf-8
import os
os.system('tools\\makeExeFile.bat')
| StarcoderdataPython |
3241743 | from dataclasses import dataclass
from dataclasses_json import dataclass_json
@dataclass_json
@dataclass
class ReplyTTSBroadCastDTO:
name: str
voice_data: str
pass
| StarcoderdataPython |
1609327 | AFFINE = True # use affine transformation when using batch or layer normalization
HIDDEN_LARGE = 1024 # nodes per hidden layer
HIDDEN_SMALL = 512 # when using fewer features
HIDDEN_TINY = 128 # for estimating values model
LAYERS_FULL = 4 # number of layers in fully connected network
LAYERS_EMBEDDING ... | StarcoderdataPython |
23511 | <reponame>ouyang-w-19/decogo
# MINLP written by GAMS Convert at 04/21/18 13:55:18
#
# Equation counts
# Total E G L N X C B
# 617 367 103 147 0 0 0 0
#
# Variable counts
# x b i... | StarcoderdataPython |
3235981 | <reponame>Kolawole39/masonite-guides-tutorial
from .Handler import Handler, StackLine
from .StackOverflowIntegration import StackOverflowIntegration
from .SolutionsIntegration import SolutionsIntegration
| StarcoderdataPython |
1606250 | <reponame>Cal-CS-61A-Staff/templar
"""Base exception for Templar."""
class TemplarError(Exception):
"""Top-level exception for Templar."""
pass
| StarcoderdataPython |
4823643 | """ Cisco_IOS_XR_ipv4_vrrp_cfg
This module contains a collection of YANG definitions
for Cisco IOS\-XR ipv4\-vrrp package configuration.
This module contains definitions
for the following management objects\:
vrrp\: VRRP configuration
This YANG module augments the
Cisco\-IOS\-XR\-snmp\-agent\-cfg
module with co... | StarcoderdataPython |
118721 | #! /usr/bin/env python
# --------------------------------------------------------------------
import re
from epydoc import docstringparser as dsp
CYTHON_SIGNATURE_RE = re.compile(
# Class name (for builtin methods)
r'^\s*((?P<class>\w+)\.)?' +
# The function name
r'(?P<func>\w+)' +
# The paramete... | StarcoderdataPython |
4160 | from torch.optim.lr_scheduler import StepLR, ReduceLROnPlateau, OneCycleLR
def step_lr(optimizer, step_size, gamma=0.1, last_epoch=-1):
"""Create LR step scheduler.
Args:
optimizer (torch.optim): Model optimizer.
step_size (int): Frequency for changing learning rate.
gamma (float): Fa... | StarcoderdataPython |
165772 | import cv2
import numpy as np
def main():
#window_name="Cam feed"
#cv2.namedWindow(window_name)
cap=cv2.VideoCapture(0)
#filename = 'F:\sample.avi'
#codec=cv2.VideoWriter_fourcc('X','V','I','D')
#framerate=30
#resolution = (500,500)
# VideoFileOutput = cv2.VideoWriter(filename,codec... | StarcoderdataPython |
90094 | <reponame>homata/geodjango-hands-on
# -*- coding: utf-8 -*-
import os
from django.contrib.gis.utils import LayerMapping
from world.models import Busstop
# Modelとファイルのカラムのマッピング
mapping = {
'p11_001' : 'P11_001' ,
'p11_002' : 'P11_002',
'p11_003_1' : 'P11_003_1',
'p11_003_2' : 'P11_003_2',
... | StarcoderdataPython |
181866 | <reponame>cdev-framework/cdev-sdk<filename>src/core/default/commands/relationaldb/utils.py
from typing import Tuple
from core.constructs.workspace import Workspace
from core.default.resources.simple.relational_db import simple_relational_db_model
RUUID = "cdev::simple::relationaldb"
def get_db_info_from_cdev_name(
... | StarcoderdataPython |
3319913 | from django import forms
from . import models
class MovieForm(forms.ModelForm):
class Meta:
model = models.Movie
fields = [
'imdb_id',
'plot',
'runtime',
'rated',
'title',
'year',
]
exclude = [
'last_rev... | StarcoderdataPython |
3209259 |
class research():
def __init__(self):
pass | StarcoderdataPython |
71528 | <reponame>raildo/keystone-1
# Copyright 2012 OpenStack 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-2.0
#
# Unless required by ap... | StarcoderdataPython |
145201 | from __future__ import print_function
import torch.backends.cudnn as cudnn
import torch
import torchvision.transforms as transforms
import argparse
import os
import random
import sys
import pprint
import datetime
import dateutil
import dateutil.tz
from StackGAN.code.miscc.datasets import TextDataset
from StackGAN.cod... | StarcoderdataPython |
3292107 | from .core import Manager
| StarcoderdataPython |
89592 | <reponame>juzb/DeeProtein<gh_stars>10-100
import subprocess
while True:
#name = input('Please enter four letter name for this run: ')
name = "AAAA"
sequence = input('Please enter the sequence to analyze: ')
gos = input('Please enter the GO terms to analyze sperarated by commas: ')
with open('/resu... | StarcoderdataPython |
3389832 | from tensorflow.python.keras.metrics import MeanMetricWrapper
# metric module to monitor arbitrary loss
class Metric(MeanMetricWrapper):
"""
A metric module to monitor arbitrary loss.
"""
def __init__(self, metric, name, dtype=None, **kwargs):
self.metric = metric
# self.name = name
... | StarcoderdataPython |
12345 | <gh_stars>10-100
###############################################################################
# Name: choicedlg.py #
# Purpose: Generic Choice Dialog #
# Author: <NAME> <<EMAIL>> #
#... | StarcoderdataPython |
1795852 | def calculate_longest_prefix_suffix(pattern, lps):
length = len(pattern)
lps[0] = 0 #lps of 0th index is always 0
l = 0
pos = 1
while pos < length:
if pattern[pos] == pattern[l]:
lps[pos] = l + 1
l += 1
pos += 1
else:
if l != 0:
... | StarcoderdataPython |
4818282 | #! python3
# -*- encoding: utf-8 -*-
'''
Current module: tests.test_driver
Rough version history:
v1.0 Original version to use
********************************************************************
@AUTHOR: Administrator-<NAME>(罗科峰)
MAIL: <EMAIL>
RCS: tests.test_driver, v1.0 2018年9月... | StarcoderdataPython |
64931 | <filename>ch02/tcp_server.py
from socket import socket, AF_INET, SOCK_STREAM
server_port = 12000
server_socket = socket(AF_INET, SOCK_STREAM)
server_socket.bind(('', server_port))
server_socket.listen(1)
print('The server is ready to receive')
while True:
connection_socket, client_address = server_socket.accept()... | StarcoderdataPython |
3244378 | # Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
'''Generates a test suite from NIST PKITS test descriptions.
The output is a set of Type Parameterized Tests which are included by
pkits_unittest.h. See pki... | StarcoderdataPython |
4813690 | import unittest
from pymetrics.metric import Metric
class Nothing(Metric):
def dump(self):
pass
def __init__(self):
Metric.__init__(self, 'test')
class TestMetric(unittest.TestCase):
def test_name_and_metric(self):
metric = Nothing()
self.assertEqual('nothing', metric.metr... | StarcoderdataPython |
3329629 | from __future__ import absolute_import, unicode_literals, print_function
import spreadsheet
spreadsheet.start()
| StarcoderdataPython |
3288554 | import psycopg2
from django.db import connection
from django.utils.text import force_text
def adapt(text):
connection.ensure_connection()
a = psycopg2.extensions.adapt(force_text(text))
c = connection.connection
# This is a workaround for https://github.com/18F/calc/issues/1498.
if hasattr(c, '_... | StarcoderdataPython |
3309173 | #!/usr/bin/env python3
# testing using unittest framework
import unittest
import sys
sys.path.append("..") # append parent folder into the system path
import egypt
class Test(unittest.TestCase):
# optional - executes before runing each test function
def setUp(self):
print('Running unittest on egypt... | StarcoderdataPython |
3226350 | <filename>socialserver/resources/config/schema.py
# Copyright (c) <NAME> 2022
from pydantic import BaseModel, IPvAnyAddress, Field, validator
from socialserver.constants import MAX_PIXEL_RATIO
from typing import Literal, Optional
class _ServerConfigNetwork(BaseModel):
host: IPvAnyAddress
# 1-65535 is the va... | StarcoderdataPython |
39329 | <reponame>wdobbels/CAAPR<gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# ** PTS -- Python Toolkit for working with SKIRT **
# ** © Astronomical Observatory, Ghent University **
# ******************************... | StarcoderdataPython |
173220 | import automox_console_sdk as automox
from automox_console_sdk.api import DevicesApi
from automox_console_sdk.api import GroupsApi
from automox_console_sdk.models import ServersIdBody, ServerGroupCreateOrUpdateRequest
from getpass import getpass
import ldap
from ldap.controls import SimplePagedResultsControl
import re
... | StarcoderdataPython |
1797749 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'gui.ui'
#
# Created by: PyQt4 UI code generator 4.11.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
... | StarcoderdataPython |
3317239 | from frictionless import describe_schema
# General
def test_describe_schema():
schema = describe_schema("data/leading-zeros.csv")
assert schema == {"fields": [{"name": "value", "type": "integer"}]}
| StarcoderdataPython |
118551 | <gh_stars>0
#import goods packages
from goods.good import Good
class Cleaning(Good):
def __init__(self):
pass | StarcoderdataPython |
162450 | <filename>lib/gstreamer/vaapi/vpp.py
###
### Copyright (C) 2018-2021 Intel Corporation
###
### SPDX-License-Identifier: BSD-3-Clause
###
import os
import slash
from ....lib.gstreamer.vppbase import BaseVppTest
from ....lib.gstreamer.util import have_gst_element
from ....lib.gstreamer.vaapi.util import map_best_hw_for... | StarcoderdataPython |
1741382 | <gh_stars>1-10
"""
Implements the TypeDefaultBounds NamedTuple, which holds information about an argument.
"""
from typing import NamedTuple, Any
from . import bounds
class TypeDefaultBounds(NamedTuple):
"""
NamedTuple representing the name, type, default value, and bounds of an argument.
"""
#: the ... | StarcoderdataPython |
3282878 | <reponame>ericchou1/network-devops-kafka-up-and-running<filename>chapter5/ch5_azure_publisher_clean.py
# Example from https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-python-get-started-send
import asyncio
from azure.eventhub.aio import EventHubProducerClient
from azure.eventhub import EventData
async def ... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.