id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
248552 | <gh_stars>1-10
'''
Description: common modules for gan model
Version: 1.0
Autor: searobbersanduck
Date: 2021-03-29 16:37:26
LastEditors: searobbersanduck
LastEditTime: 2021-03-31 09:36:52
License : (C)Copyright 2020-2021, MIT
'''
# ref: https://github.com/junyanz/pytorch-CycleGAN-and-pix2pix/blob/master/models/network... | StarcoderdataPython |
3322610 | <filename>web/deploy/wtdeploy/wtdeploy/modules/fab_nginx.py
#!/usr/bin/python
# -*- encoding: utf-8 -*-
#
# author: <NAME>
from fabric.api import sudo
from fabric.api import cd
from fabric.api import run
from fabric.api import env
from fabric.contrib.files import upload_template
from fabric.contrib.files import exists... | StarcoderdataPython |
1808001 | <filename>Init_Guide/text-search/file-search.py
f_opn = open("file.txt", "r")
for line in f_opn:
if "hello" in line:
print line
f_opn.close()
| StarcoderdataPython |
5191018 | from django.db import models
class LastRun(models.Model):
"""
Table: Lastrun
Comment: Table that stores all the background runner last run.
"""
component = models.CharField(max_length=30)
last_run = models.DateTimeField(auto_now=True, blank=True)
def __str__(self):
return self.com... | StarcoderdataPython |
6687927 | <reponame>RKatana/inventory-app-django
# Generated by Django 3.2.8 on 2021-10-12 14:09
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('authentication', '0002_profile'),
]
operations = [
migrations.RenameField(
model_name='profile',
... | StarcoderdataPython |
368046 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import sqlite3 as lite
import sys
con = lite.connect('test.db')
bookname = input("Book Name: ")
scifi = input ("Is this a Scifi book? y/n :")
with con:
cur = con.cursor()
cur.execute ("DROP TABLE IF EXISTS Book_classifier;")
cur.execute("CREATE TABLE Boo... | StarcoderdataPython |
6705531 | <gh_stars>0
# Generated by Django 3.0.4 on 2020-05-07 14:50
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0002_auto_20200426_1713'),
]
operations = [
migrations.CreateModel(
name='R... | StarcoderdataPython |
5163425 | # coding:utf-8
import pymysql
con = pymysql.connect(
host='127.0.0.1',
user='root',
password='<PASSWORD>',
port=3306,
database='android_app'
)
print(con)
cur = con.cursor()
print(cur)
cur.execute("select * from user")
print(cur.fetchone())
| StarcoderdataPython |
3493520 | """Console module.
Collection of console helpers.
"""
import sys
import beeprint
DEBUG = False
def pp(var):
"""Pretty print.
Wrapper around beeprint
Args:
var: some variable
"""
beeprint.pp(var)
def dd(var):
"""Pretty print and die.
Args:
var: some variable
"""... | StarcoderdataPython |
3569559 | <reponame>ihmeuw/vivarium
from .hdf import EntityKey
from .artifact import Artifact, ArtifactException
from .manager import ArtifactManager, ArtifactInterface, parse_artifact_path_config, filter_data, validate_filter_term
| StarcoderdataPython |
1710118 | import sys
import pytest
from konfetti import Konfig
from konfetti.exceptions import ForbiddenOverrideError
pytestmark = [pytest.mark.usefixtures("settings")]
skip_if_py2 = pytest.mark.skipif(sys.version_info[0] == 2, reason="Async syntax is not supported on Python 2.")
def test_override_function(testdir):
"... | StarcoderdataPython |
5012432 | """
Used for analysis of public companies filing with the
United States SEC.
"""
from dataclasses import dataclass
from typing import Iterable, Tuple, Union
import pandas as pd
from ..dataframes import Form10K, Form10Q, HistoricalStockPrices
from ..utils import NestedDepthError, nested_depth, ticker_or_ci... | StarcoderdataPython |
9757324 | import numpy as np
import pandas as pd
import statsmodels.api as sm
# Gaussian
algodao = pd.DataFrame({'percent' : [15, 20, 25, 30, 35,
15, 20, 25, 30, 35,
15, 20, 25, 30, 35,
15, 20, 25, 30, 35,
15, 20, 25, 30, 35 ],
'resist' : [7, 12, 14, 19, 7,
7, 17, 18, 25, 10,
15, 12, 18, 22, 11,
11, 18, 19, 19, 15,
9, 18, ... | StarcoderdataPython |
368750 | #?install ~/.pdbrc.py -*-python-*-
#
# pdbrc.py - Advanced configuration for the Python debugger
#
# https://wiki.python.org/moin/PdbRcIdea
# Readline: see also pythonrc
try:
import readline
except ImportError:
print("Warning: readline module not available")
else:
# FIXME: improve completion
# Use a ... | StarcoderdataPython |
12865533 | <reponame>WWGolay/iota
#!/usr/bin/python
import pycurl
from io import BytesIO
def checkOpen():
isOpen = False
buffer = BytesIO()
c = pycurl.Curl()
c.setopt(c.URL, 'https://www.winer.org/Site/Roof.php')
c.setopt(c.WRITEDATA, buffer)
c.perform()
c.close()
body = buffer.get... | StarcoderdataPython |
8181360 | from django.contrib import admin
from django.contrib.auth.models import Group
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from .forms import UserCreationForm
from .models import MyUser
# Register your models here.
class UserAdmin(BaseUserAdmin):
add_form = UserCreationForm
list_display = ('u... | StarcoderdataPython |
4943628 | import collections
class Solution:
def numSubmatrixSumTarget(self, matrix: List[List[int]], target: int) -> int:
presum = [[0] * (len(matrix[0]) + 1) for _ in range(len(matrix))]
for i in range(len(matrix)):
for j in range(len(matrix[0])):
presum[i][j + 1] = presum[i][j] ... | StarcoderdataPython |
6509139 | <reponame>chiranjeevbitp/Python27new<gh_stars>0
from matplotlib import pyplot as plt
plt.bar([1,3,5,7,9],[5,7,2,8,2],label='line one')
plt.bar([2,4,6,8,10],[8,6,2,5,4],label='line one',color='b')
plt.title('Epic info')
plt.ylabel('Y axis')
plt.xlabel('X axis')
plt.legend()
#plt.grid(True,color='g')
plt.show() | StarcoderdataPython |
6688263 | import os
import sys
def setup_env(env, version):
if sys.platform == 'darwin':
core_dir = '/Applications/redshift'
else:
core_dir = '/usr/redshift'
module_dir = os.path.join(core_dir, 'redshift4maya')
version_dir = os.path.join(module_dir, version)
if not os.path.exists(version_... | StarcoderdataPython |
6401841 | <filename>api/plugins/memory.py
from cmdb import models
from django.db import transaction
class Memory(object):
def __init__(self, server_obj, info, u_obj=None):
self.server_obj = server_obj
self.mem_dict = info
self.u_obj = u_obj
def process(self):
new_mem_info_dict = self.me... | StarcoderdataPython |
5166575 | <gh_stars>1-10
from django.contrib.auth.models import User
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
class Profile(models.Model):
bio = models.TextField(blank=True)
birth_date = models.DateTimeField(null=True, blank=True)
country = mod... | StarcoderdataPython |
6428761 | from django import forms
from django.utils.translation import ugettext_lazy as _
from accounts.models import User
from .models import Organization
class OrganizationRegistrationForm(forms.ModelForm):
class Meta:
model = Organization
class OwnerRegistrationForm(forms.ModelForm):
password1 = forms.... | StarcoderdataPython |
306494 | <filename>tools/record_create.py
"""
Tool: Record responses of creating a gist for unit test use
"""
import json
import pathlib
from typing import Dict
from typing import NamedTuple
from egggist.egggist import EggGist
from egggist.egggist import File
FILE_PATH = "tests/fixtures"
FILE_SUCCESS = "create_success.json"
F... | StarcoderdataPython |
5141128 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import argparse
import pandas as pd
from lib.programme_data import *
def filter_data(all_data):
"""
Remove all the students not applying for this current year
"""
# Remove all students not from this academic year
YEAR_COLUMN = 'Entry Year'
T... | StarcoderdataPython |
6562726 | # View more python learning tutorial on my Youtube and Youku channel!!!
# Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg
# Youku video tutorial: http://i.youku.com/pythontutorial
"""
Please note, this code is only for python 3+. If you are using python 2+, please modify the code acco... | StarcoderdataPython |
1692163 | import os
from pytorch_lightning.callbacks import ModelCheckpoint, EarlyStopping, ProgressBarBase, ProgressBar
from pytorch_lightning.utilities.exceptions import MisconfigurationException
class CallbackConnector:
def __init__(self, trainer):
self.trainer = trainer
def on_trainer_init(
se... | StarcoderdataPython |
1868277 | import time
from conans import load
from conans.errors import ConanException, NotFoundException
from conans.model.ref import PackageReference, ConanFileReference
from conans.util.log import logger
from conans.client.source import complete_recipe_sources
from conans.search.search import search_recipes, search_packages
... | StarcoderdataPython |
4915095 | <filename>modules/modelchecker/statespace.py<gh_stars>1-10
import re
class StateSpace:
def __init__(self, _stateSpace=dict(), _declarations=""):
self.statespace = _stateSpace.copy()
self.declarations = _declarations
def addState(self, position, state):
self.statespace[position] = stat... | StarcoderdataPython |
5153290 | <reponame>nickersk/streamlink-27
import logging
import re
from streamlink.plugin import Plugin, pluginmatcher
from streamlink.plugin.api import validate
from streamlink.stream.hls import HLSStream
log = logging.getLogger(__name__)
STREAMS_URL = "https://piczel.tv/api/streams?followedStreams=false&live_only=false&sf... | StarcoderdataPython |
1608872 | <reponame>alliance-genome/agr_literature_service<filename>backend/app/literature/crud/reference_manual_term_tag_crud.py
from sqlalchemy.orm import Session
from fastapi import HTTPException
from fastapi import status
from fastapi.encoders import jsonable_encoder
from literature.schemas import ReferenceManualTermTagSch... | StarcoderdataPython |
3238349 | """Shonan Rotation Averaging.
The algorithm was proposed in "Shonan Rotation Averaging:Global Optimality by
Surfing SO(p)^n" and is implemented by wrapping up over implementation provided
by GTSAM.
References:
- https://arxiv.org/abs/2008.02737
- https://gtsam.org/
Authors: <NAME>, <NAME>, <NAME>
"""
from typing imp... | StarcoderdataPython |
326398 | etree.SubElement(dictionary, u'Name').text = dict_name | StarcoderdataPython |
8054645 | <reponame>Pahandrovich/omniscidb
def get_source_version():
import os
d = dict(MAJOR='5', MINOR='6', MICRO='0', EXTRA='none')
here = os.path.abspath(os.path.dirname(__file__))
try:
f = open(os.path.join(here, '..', '..', 'CMakeLists.txt'))
except FileNotFoundError:
return None
for... | StarcoderdataPython |
9682044 | <filename>src/verify/design/message.py
"""
"""
import struct
from dataclasses import dataclass, field
from data_pipe.packer import BufferPacker
@dataclass(frozen=True)
class MessageBuffer(BufferPacker):
""
buffer:memoryview
| StarcoderdataPython |
1812035 | <gh_stars>0
# Generated by Django 3.0 on 2021-08-16 23:50
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('shop', '0002_auto_20210723_1518'),
('orders', '0001_initial'),
]
operations = [
migrations.RenameModel(
old_name='Orde... | StarcoderdataPython |
14870 | # Copyright 2015 - Mirantis, Inc.
# Copyright 2015 - StackStorm, 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
#
# Unl... | StarcoderdataPython |
1984066 | """Unique Paths
A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).
The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked 'Finish' in the diagram below).
How many possible unique paths a... | StarcoderdataPython |
272718 | <reponame>NiklasRosenstein/houdini-manage<filename>houdini_manage/gui.py
# Copyright (C) 2017 <NAME>
#
# 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 |
8035697 | <reponame>a-farahani/Time-series-object-detection
import setuptools
with open("README.md", 'r') as fp:
long_description = fp.read()
setuptools.setup(
name = "rhodes",
version = "1.0.2",
author="<NAME>, <NAME>, <NAME>",
author_email="<EMAIL>, <EMAIL>, <EMAIL>",
license='MIT',
description="A package for neuron d... | StarcoderdataPython |
1719633 | <gh_stars>0
"""
The classification test module.
"""
| StarcoderdataPython |
5153512 | from flask import Blueprint
bp = Blueprint('case_new', __name__)
from app.case_new import routes
| StarcoderdataPython |
4807347 | """
MIT License
Copyright (c) 2021, <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distr... | StarcoderdataPython |
3392044 | <reponame>Ernestyj/PyStudy<filename>finance/TradingAlgo.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.finance as finance
import zipline as zp
import math
from datetime import datetime
from zipline import TradingAlgorithm
clas... | StarcoderdataPython |
11361709 | <reponame>dawidkski/space<filename>python/src/tensor/nn.py<gh_stars>1-10
from typing import List
from . import tensor as ts
from . import libtensor as _ts
from .autograd import Op, Variable
from .libtensor import Activation
class Conv2D(Op):
def __init__(self, in_channels: int, out_channels: int, kernel_size: in... | StarcoderdataPython |
5037368 | <gh_stars>0
import route
if __name__ == '__main__':
route.run() | StarcoderdataPython |
30965 | import requests
from teste_app import settigns
def google(q: str):
"""Faz uma pesquisa no google"""
return requests.get(settigns.GOOGLE, params={"q": q})
| StarcoderdataPython |
1926895 |
#self._write_u8(_DRV2605_REG_AUDIOMAX, 0x64)
#self._write_u8(_DRV2605_REG_AUTOCALCOMP, 1) # = const(0x18)
#self._write_u8(_DRV2605_REG_AUTOCALEMP, 1) # = const(0x19)
#self._write_u8(_DRV2605_REG_FEEDBACK, 1) # = const(0x1A)
# G0832012 LRA
# rated voltage... | StarcoderdataPython |
9643105 | x = 10
print(x)
y = 5
print(x)
print(y)
my_name = "kittaphot_saeng"
age = 17
height = 162
weight = 89.2
print(my_name,age,height,weight) | StarcoderdataPython |
6555117 | """empty message
Revision ID: e60c3d8b005
Revises: 52ae2f07ac3a
Create Date: 2014-12-09 15:39:16.272520
"""
# revision identifiers, used by Alembic.
revision = 'e60c3d8b005'
down_revision = '52ae2f07ac3a'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - plea... | StarcoderdataPython |
8195668 | exp_name = 'glean_in128out1024_4x2_300k_ffhq_celebahq'
scale = 8
# model settings
model = dict(
type='GLEAN',
generator=dict(
type='GLEANStyleGANv2',
in_size=128,
out_size=1024,
style_channels=512,
pretrained=dict(
ckpt_path='http://download.openmmlab.com/mmg... | StarcoderdataPython |
249930 | <gh_stars>0
import plotly_express as px
import pandas as pd
basic_plot = px.line(x=[1,2,3,4,5],
y=[2,3,4,5,6],
title="Basic line plots")
basic_plot.show() | StarcoderdataPython |
304232 | import os
import time
import random
import logging
import traceback
import subprocess
from multiprocessing import Pool
class GymFCMiner:
def __init__(self):
pass
def run_sh(self, args: tuple):
command = args[0]
if args.__len__() == 2:
thread_name = args[1]
else:
... | StarcoderdataPython |
1792552 | import gumtreescraper
from gumtreescraper import SearchListing
from gumtreescraper import SearchAd
search = SearchListing()
searchResult = search.doSearch()
print (searchResult)
for i in searchResult:
ad = SearchAd(i.url)
ad.parsAd()
print(i)
| StarcoderdataPython |
9772712 | <reponame>ZhiangChen/FCN.tensorflow
"""
Define Constants
"""
CAFFE_ROOT = '/home/huxley/caffe/'
# Params
PERCENTAGE_TRAIN = 0.2
NUM_TRAIN_PER_IMAGE = 100
CROP_WIDTH = 240
CROP_HEIGHT = 320
""" BLOB CONSTANTS """
BLOB_DATA_ROOT = '/notebooks/FCN.tensorflow/dataroot... | StarcoderdataPython |
5030686 | <reponame>mssung94/daishin-trading-system<filename>tutorial/33.py
# 대신증권 API
# 주식 잔고 실시간 조회(현재가 및 주문 체결 실시간 반영)
# 이번 예제는 PLUS API 를 이용하여 주식 잔고를 조회 하고, 실시간으로 현재가와 주문 체결 변경 상황을 관리하는 예제 입니다.
# ■ 사용된 클래스
# ▥ CpEvent - 실시간 이벤트 수신 (현재가와 주문 체결 실시간 처리)
# ▥ Cp6033 - 주식 잔고 조회
# ▥ CpRPCurrentPrice - 현재가 한 종목 조... | StarcoderdataPython |
4828694 | <gh_stars>0
import Camera
class Configuration(object):
def __init__(self, filename):
import xml.etree.ElementTree as ET
configxml = ET.parse(filename)
self.data = {}
self.data["name"] = configxml.find("name").text
self.data["video_len"] = int(configxml.find("video/length").t... | StarcoderdataPython |
391917 | from tkinter import *
root = Tk()
root.title("calculator")
root.geometry('280x430')
root.resizable(width=0, height=0)
root.iconbitmap('calc.ico')
root.iconbitmap()
e = Entry(root, width=35, borderwidth=5)
e.grid(row=0, column=0, columnspan=3, padx=10, pady=10)
# click function
def button_click(numbe... | StarcoderdataPython |
1762111 | <filename>src/batch/app/ProducerConsumer.py<gh_stars>0
import json
from elasticsearch import Elasticsearch
from kafka import KafkaConsumer
consumer = KafkaConsumer('new-posts',
group_id='creating-posts',
bootstrap_servers=['kafka:9092'])
esbody = {
"mappings": {
... | StarcoderdataPython |
3294053 | <filename>tests/hooks/test_get_app.py
from ocean_spark.hooks import OceanSparkHook
from unittest.mock import MagicMock
def test_get_app(successful_get_app: None, get_connection_mock: None) -> None:
hook = OceanSparkHook()
app_dict = hook.get_app("test-app-name")
assert app_dict is not None
assert app_... | StarcoderdataPython |
3335967 | #!/usr/bin/env python3
# -*- coding: utf8 -*-
import argparse
import sys
import os
import numpy as np
import modules.segmentation_points as segment
from modules.data_set import DataSet
from modules.segmentation_kind import *
from modules.sensors import sensors
from modules.constants import *
from plotter import main_i... | StarcoderdataPython |
9615984 | <filename>venv/lib/python3.6/site-packages/ansible_collections/fortinet/fortios/plugins/modules/fortios_firewall_proxy_policy.py<gh_stars>1-10
#!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019-2020 Fortinet, Inc.
#
# This program is free software: you can redistribute... | StarcoderdataPython |
5029874 | from numpy import zeros
# scipy implementation has issues with different sized matrices
def block_diag(matrix_list):
""""""
row_length = sum(mat.shape[0] for mat in matrix_list)
col_length = sum(mat.shape[1] for mat in matrix_list)
result = zeros((row_length, col_length))
row_idx = col_idx = 0
... | StarcoderdataPython |
294423 | from crispy_forms.bootstrap import InlineCheckboxes
from crispy_forms.helper import FormHelper
from crispy_forms.layout import HTML, ButtonHolder, Div, Fieldset, Layout, Submit
from datetimewidget.widgets import DateWidget
from django import forms
from .models import (
CHF,
CKD,
IBD,
PVD,
Alcohol,
... | StarcoderdataPython |
1719553 | <reponame>MarcinOrlowski/prop-tool<filename>tests/checks/test_quotation_marks.py<gh_stars>1-10
"""
# trans-tool
# The translation files checker and syncing tool.
#
# Copyright ©2021 <NAME> <mail [@] <EMAIL>>
# https://github.com/MarcinOrlowski/trans-tool/
#
"""
from typing import Dict, Union
from transtool.checks.base... | StarcoderdataPython |
6525181 | import numpy as np
from speech_datasets.transform.interface import FuncTrans
def delta(feat, window):
assert window > 0
delta_feat = np.zeros_like(feat)
for i in range(1, window + 1):
delta_feat[:-i] += i * feat[i:]
delta_feat[i:] += -i * feat[:-i]
delta_feat[-i:] += i * feat[-1]
... | StarcoderdataPython |
8151680 | <filename>days_conversion.py<gh_stars>0
no_of_days=int(input())
years=int(((no_of_days)/365))
weeks=int((no_of_days % 365)/7)
days=int(((no_of_days)%365)%7)
result=(years+" "+"years"+" "+weeks+" "+"weeks"+" "+days+" "+days)
print(result) | StarcoderdataPython |
3356467 | import os
import gdal
import osr
import logging
import glob
import shapefile
import geopandas as gp
import numpy as np
import settings
from cv2 import imread
from shapely.geometry import Polygon
from PIL import Image, ImageDraw
logging.getLogger('shapely.geos').setLevel(logging.CRITICAL)
class Tili... | StarcoderdataPython |
9720171 | # coding=utf-8
# Copyright 2018-2020 EVA
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | StarcoderdataPython |
1718909 | try:
import mock
except ImportError: # PY3
from unittest import mock
from simple_module.level_two.other import other_func
def test_other_func(mock_func):
"""
You can mock functions imported from a different
module.
"""
mock_func.return_value = mock.sentinel.retval
ret = other_func(m... | StarcoderdataPython |
307385 | # -*- coding: utf-8 -*-
import curses
from curses import panel
from strategy import get_pytify_class_by_platform
"""
TODO: Rewrite this crappy menu class
"""
class Menu(object):
def __init__(self, items, stdscreen):
self.pytify = get_pytify_class_by_platform()()
self.window = stdscreen.subwin(0... | StarcoderdataPython |
3531588 | <filename>models/equipment.py
from pydantic import BaseModel, Field
from typing import List, Optional
from helpers.objectid import PyObjectId
from bson import ObjectId
class Equipment(BaseModel):
id: Optional[PyObjectId] = Field(alias='_id')
mac_address: str
name: str
description: str
samppling_f... | StarcoderdataPython |
12847832 | <reponame>emina13/ITMO_ICT_WebDevelopment_2021-2022
from rest_framework.authentication import TokenAuthentication
from rest_framework.generics import *
from rest_framework.permissions import *
from .serializers import *
class IsManager(BasePermission):
def has_permission(self, request, view):
return reque... | StarcoderdataPython |
3477280 | from collections import defaultdict
from typing import Iterable, List
import torch
from ppq.core import (COMPELING_OP_TYPES, LINEAR_ACTIVATIONS,
ORT_OOS_FUSE_START_OPS, PPLCUDA_ACTIVATIONS,
QuantizationProperty, QuantizationStates, RoundingPolicy,
Targe... | StarcoderdataPython |
325690 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
# @package coursera2012
# @author <NAME> <<EMAIL>>
# @version 1.00
# @date 2015-01-01
# @copyright Apache License, Version 2.0
#
# Implementation of the game
# "Guess The Number"
# for the Coursera course
# "An Introduction to Interact... | StarcoderdataPython |
11347224 | import aiohttp
import config
import ujson
GIPHY_RANDOM_URL = 'http://api.giphy.com/v1/gifs/random?tag=cat&limit=5&api_key='
# Random cat gif from giphy.com
class GiphyConnector:
"""Base gifs and mp4 sources class"""
# asynchronous load content from url
@staticmethod
async def get(url):
async ... | StarcoderdataPython |
9670994 | <filename>2020/10/p2.py
# Python 3.8.3
from collections import defaultdict
def count_paths(chain):
d = defaultdict(int)
d[0] = 1
for i in chain:
d[i] = d[i - 3] + d[i - 2] + d[i - 1]
return d[i]
def get_input():
with open("input.txt", "r") as f:
return set(int(i) for i in f.read... | StarcoderdataPython |
11292901 | <reponame>royerloic/aydin<filename>aydin/util/denoise_nd/test/test_denoise_nd.py
# flake8: noqa
import numpy
from scipy.ndimage import gaussian_filter
from aydin.util.denoise_nd.denoise_nd import extend_nd
def test_denoise_nd():
# raw function that only supports 2D images:
def function(image, sigma):
... | StarcoderdataPython |
4931605 | """
Rocketfuel topology and traffic matrix
======================================
This example shows how to import a topology from RocketFuel, configure it
(assign capacities, weights and delays), generate a traffic matrix and
save topology and traffic matrix to XML files.
"""
import fnss
import random
# Import Rocke... | StarcoderdataPython |
12861724 | <reponame>gliahq/Glia
from PyQt5.QtWidgets import QTabWidget
from glia.widgets.editor import Editor
class EditorTabs(QTabWidget):
def __init__(self, parent=None):
"""
Generates tab with editor depending on the file and it's type
selected.
"""
super(EditorTabs, self).__init... | StarcoderdataPython |
11327597 | from docker.api import APIClient
from docker.client import DockerClient
import pytest
from deck_chores.utils import split_string
@pytest.fixture
def cfg(mocker):
from deck_chores.config import cfg
cfg.client = mocker.MagicMock(DockerClient)
cfg.client.api = mocker.MagicMock(APIClient)
cfg.debug = Tr... | StarcoderdataPython |
6696007 | from mindspore.train.serialization import load_checkpoint, load_param_into_net
def load_ckpt(network, pretrain_ckpt_path, trainable=True):
"""
incremental_learning or not
"""
param_dict = load_checkpoint(pretrain_ckpt_path)
load_param_into_net(network, param_dict)
if not trainable:
for ... | StarcoderdataPython |
11288163 | <filename>money/money.py
from __future__ import annotations
from .currency import Currency
import operator
import math
class Money:
def __init__(self, amount: int, currency: Currency):
self.__assert_amount(amount)
self.__amount = amount
self.__currency = currency
def instance(self, ... | StarcoderdataPython |
194330 | <reponame>ripolln/hywaves
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# pip
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
# import constants
from .config import _faspect, _fsize, _fdpi
def axplot_scatter_mda_vs_data(ax, x_mda, y_mda, x_data, y_data):
'axes scatter plot variable1 vs va... | StarcoderdataPython |
11329116 | import pkgutil
import importlib
from base64 import b64encode, b64decode
from functools import partial
from gql.client import Client
from . import api
from .api.input.turn import Turn
def wrapper(self, func):
def inner(*args, **kwargs):
result = func(self, *args, **kwargs)
if hasattr(result, "resul... | StarcoderdataPython |
4946963 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# Copyright 2021-... <NAME> <<EMAIL>>.
# This program is distributed under the MIT license.
# Glory to Ukraine!
import os
import lxml.etree
from termcolor import colored
import DipTrace
def store_temp(data, name) -> str:
if not os.path.exists('temp'):
os.mkdir('temp')
... | StarcoderdataPython |
4895642 | <filename>es_maml/blackbox/blackbox_functions.py
# coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# 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/lic... | StarcoderdataPython |
6536877 | <filename>tetris.py
import pygame
import random
pygame.init()
class Point: # Struktrua do tab[]
def __init__(self, x=0, y=0):
self.x = x
self.y = y
self.name = 0
class Pole: # Struktura do blocksTab
def __init__(self, color, empty):
self.empty = empty
self.color = colo... | StarcoderdataPython |
1762761 | <reponame>su-vikas/pytlspect
# Authors:
# <NAME>
# Google - defining ClientCertificateType
# Google (adapted by <NAME>) - NPN support
# <NAME> - Anon ciphersuites
# <NAME> (Arcode Corporation) - canonicalCipherName
#
# See the LICENSE file for legal information regarding use of this file.
"""Constants used i... | StarcoderdataPython |
132347 | <filename>build/driver/joystick/joystick_drivers/wiimote/cmake/wiimote-genmsg-context.py
# generated from genmsg/cmake/pkg-genmsg.context.in
messages_str = "/home/lty/catkin_ws/src/driver/joystick/joystick_drivers/wiimote/msg/IrSourceInfo.msg;/home/lty/catkin_ws/src/driver/joystick/joystick_drivers/wiimote/msg/State.m... | StarcoderdataPython |
12840316 | from configutator import ConfigMap, ArgMap, EnvMap, loadConfig
import sys
def test(param1: int, param2: str):
"""
This is a test
:param param1: An integer
:param param2: A string
:return: Print the params
"""
print(param1, param2)
if __name__ == '__main__':
for argMap in loadConfig(sys... | StarcoderdataPython |
173488 |
"""
Functions to read talks data.
"""
import tempfile
import json
from ..server_utils import epcon_fetch_file
def _call_for_talks(out_filepath, status="accepted", conference="ep2017", host="europython.io", with_votes=False):
""" Create json file with talks data. `status` choices: ['accepted', 'proposed']
""... | StarcoderdataPython |
12264 | <filename>app/request/queue.py
import logging
from time import sleep
logger = logging.getLogger(__name__)
class StopRequestQueue:
cursor = 0
queue = None
service = None
current_request = None
request_delay = 0 # seconds
def __init__(self, service, request_delay=10):
self.queue = []
self.service ... | StarcoderdataPython |
8159095 | <reponame>dqshuai/MetaFormer
import os
import torch
import importlib
import torch.distributed as dist
try:
# noinspection PyUnresolvedReferences
from apex import amp
except ImportError:
amp = None
def relative_bias_interpolate(checkpoint,config):
for k in list(checkpoint['model']):
if 'relativ... | StarcoderdataPython |
11264705 | <filename>data/temp/czml3_test.py<gh_stars>0
# from czml3.examples import simple
# output=simple
import gdal
from gdalos.calc.gdal_to_czml import gdal_to_czml
raster_filename = r'd:\dev\czml\1.tif'
ds = gdal.Open(raster_filename, gdal.GA_ReadOnly)
ds, output = gdal_to_czml.gdal_to_czml(ds, name="")
del ds
print(outp... | StarcoderdataPython |
3251211 | <gh_stars>10-100
"""Initial migration.
Revision ID: <PASSWORD>
Revises:
Create Date: 2018-02-07 21:05:49.629867
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '<PASSWORD>'
down_revision = None
branch_labels = None
dep... | StarcoderdataPython |
8002526 | from clubs.models import Club, FinancialStatementFact, FinancialStatementLine
from rest_framework import viewsets, permissions
from .searilizers import ClubSerializer, FinancialStatementFactSerializer, FinancialStatementLineSerializer
from rest_framework.decorators import action
from rest_framework.response import Resp... | StarcoderdataPython |
93073 | <filename>websauna/system/core/traversal.py<gh_stars>100-1000
"""Traversing core logic."""
# Pyramid
from pyramid.interfaces import ILocation
from zope.interface import implementer
@implementer(ILocation)
class Resource:
"""Traversable resource in a nested tree hierarchy with basic breadcrumbs support.
All t... | StarcoderdataPython |
9641636 | import pytest
import xarray as xr
from ipyfastscape.common import (
AppComponent,
AppLinker,
Coloring,
DimensionExplorer,
TimeStepper,
VizApp,
)
from .utils import counter_callback
def test_app_component(dataset_init):
with pytest.raises(NotImplementedError):
AppComponent(datase... | StarcoderdataPython |
12829298 | """
Description:
"""
__author__ = "<NAME>, <NAME>, <NAME>"
| StarcoderdataPython |
8191804 | <gh_stars>0
import copy
import time
from collections import Counter
"""Errors are still being found, validation processes are currently being built"""
"""If an error is found please notify"
class Puzzles:
Suduko_Input_Matrix_0 = [[0, 0, 0, 2, 6, 0, 7, 0, 1],
[6, 8, 0, 0, 7, 0... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.