id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
1693338 | #
# Copyright (c) 2013-2018 Quarkslab.
# This file is part of IRMA project.
#
# 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 in the top-level directory
# of this distribution and at:
#
# http:... | StarcoderdataPython |
79697 | import numpy as np
from scipy import ndimage
__all__ = ['gabor_kernel', 'gabor_filter']
def _sigma_prefactor(bandwidth):
b = bandwidth
# See http://www.cs.rug.nl/~imaging/simplecell.html
return 1.0 / np.pi * np.sqrt(np.log(2)/2.0) * (2.0**b + 1) / (2.0**b - 1)
def gabor_kernel(frequency, theta=0, band... | StarcoderdataPython |
3306524 | <reponame>Rousan99/Azazaya
from manim import *
class Introduction(Scene):
config.background_color = "#1b1b1b"
def construct(self):
title = Title("Area of Dodecagon - Proof without talk").set_color_by_gradient(RED,ORANGE,YELLOW,GREEN,BLUE)
title.scale(0.7)
self.play(Write(title))
... | StarcoderdataPython |
1728317 | <gh_stars>10-100
from Job import Job
import binascii #TODO: move outside ?
# TODO: move into other file if another implementation is done
# Subscription state
class Subscription(object):
'''Encapsulates the Subscription state from the JSON-RPC2 server'''
# Subclasses should override this
def ProofOfWork(header):
... | StarcoderdataPython |
1635533 | import pytest
import numpy as np
from sklearn.neighbors import KNeighborsClassifier
from sklearn.linear_model import LinearRegression, Ridge, LogisticRegression
from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor
from sklego.common import flatten
from sklego.meta import DecayEstimator
from tests.co... | StarcoderdataPython |
1640859 | <gh_stars>0
# The MIT License (MIT)
#
# Copyright (c) 2017 <NAME> for Adafruit Industries.
#
# 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 ... | StarcoderdataPython |
3205612 | <filename>gen_sample.py
import numpy as np
def sinewave(f):
srate = 16000
return lambda i: np.sin(2 * np.pi * f * i / srate)
def zero_spectrum(fs):
sines = map(sinewave, fs)
return lambda i: sum(map(lambda f: f(i), sines)) / len(fs)
def spectrum(fs):
amplitude = 32767
zsp = zero_spectrum(fs)
... | StarcoderdataPython |
3381219 | #!/usr/bin/env python
def main():
print "=" * 120
print " If you can see that all your cores are running at 100% then you are using optimised ATLAS library."
print "=" * 120
print
import numpy
# numpy.test() #this should run with no errors (skipped tests and known-fails are ok)
size = 8000... | StarcoderdataPython |
193949 | <gh_stars>1-10
# -*- coding:utf-8 -*-
import requests, re, os, configparser, time, hashlib, json, shutil, traceback
from PIL import Image
# 调用百度翻译API接口
def tran(api_id, key, word, to_lang):
# init salt and final_sign
salt = str(time.time())[:10]
final_sign = api_id + word + salt + key
final_... | StarcoderdataPython |
21684 | from . import program
from . import turtle_test
from . import antoine_test
from . import dance | StarcoderdataPython |
3316855 | <filename>app/engine/overworld/overworld_states.py
import logging
import app.engine.config as cf
from app.data.database import DB
from app.engine import engine, menus
from app.engine.fluid_scroll import FluidScroll
from app.engine.game_state import game
from app.engine.input_manager import INPUT
from app.engine.object... | StarcoderdataPython |
1719432 | def weiner(text, n):
text = text + '$'
root = trie.TrieNode("")
link, head = { (root, ""): root }, root
for i in range(n + 1, 0, -1):
# niezmiennik: link[v][c] = u dla wewnętrznych u i v takich, że word(u) = c word(v)
v, depth = head, n + 2
while v != root and link.get((v, text[i])) is None:
v... | StarcoderdataPython |
1768082 | while True:
try:
cont = 0
cont2 = 0
calculo = 0
N = int(input())
Votos = (input().split())
for i in range(N):
if (int(Votos[cont])) == 1:
cont2 += 1
cont += 1
calculo = (N / 3) * 2
if cont2 >= calculo:
... | StarcoderdataPython |
3348475 | # Generated by Django 3.0.3 on 2020-03-10 12:50
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('interview_backend', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='company',... | StarcoderdataPython |
1737926 | import os, sys
import Image
size = 100, 100
for infile in sys.argv[1:]:
outfile = os.path.splitext(infile)[0] + ".thumbnail"
if infile != outfile:
try:
im = Image.open(infile)
im.thumbnail(size, Image.ANTIALIAS)
im.save(outfile, "JPEG")
except IOError:
... | StarcoderdataPython |
53616 | <reponame>aayla-secura/simple_CORS_https_server
from setuptools import setup, find_packages
with open('README.md', 'r') as fh:
long_description = fh.read()
setup(
name='mixnmatchttp',
version='1.0.dev32',
url='https://github.com/aayla-secura/mixnmatchttp',
author='AaylaSecura1138',
author_emai... | StarcoderdataPython |
1644794 | <gh_stars>1-10
# Kate is stuck in a maze. You should help her to find her way out.
# On the first line, you will be given how many rows there are in the maze. On the following n lines, you will be given the maze itself. Here is a legend for the maze:
# • "#" - means a wall; Kate cannot go through there
# • " " - means ... | StarcoderdataPython |
4842678 | <filename>src/psion/oauth2/authentication/methods/__init__.py
from .base import BaseAuthentication
from .client_secret_basic import ClientSecretBasic
from .client_secret_post import ClientSecretPost
from .none import None_
| StarcoderdataPython |
1628876 | <filename>baselines/EMNLP2019/config.py<gh_stars>100-1000
#MODEL = "simple_pipeline"
#MODEL = "pipeline_without_global"
#MODEL = "best_pipeline"
#MODEL = "ours"
MODEL = "bert"
NUMBER_URI_CANDIDATES = 1 if MODEL == "ours" else 1
NUMBER_URI_CANDIDATES_TO_CONSIDER = 1
URI_THRESHOLD = 0.0
SOFT_COREF_CANDIDATES = MODEL == ... | StarcoderdataPython |
3258232 | <gh_stars>1-10
"""This module tests the githubactions module"""
from configator import create_actions_config
def test_create_configator_file_creates_github_actions(mocker):
""" Testing to see if a file is created through github_actions"""
mock_open = mocker.mock_open()
#take in buildin open function and r... | StarcoderdataPython |
1635656 | <filename>examples/application_commands/autocomplete.py
import discpy
from discpy.ext import commands
bot = commands.Bot(command_prefix='>')
# these are the list of items that will be
# shown as choices in autocomplete.
ITEMS = ['Bun', 'Cake', 'Cookie', 'Bread', 'Orange Juice']
# this function would autocomplete the... | StarcoderdataPython |
4811035 | <filename>python4kyoani/util.py
def name_for_save(image_path):
return f'pray_{image_path.name}'
| StarcoderdataPython |
1608320 | <gh_stars>10-100
from mechanize import Browser
import sys
import os
import re
def get_filelist(url):
child_stdin, child_stdout, child_stderr = os.popen3(['rsync', '-r', url])
#child_stdin, child_stdout, child_stderr = os.popen3(['cat', 'buildservice-repos.txt'])
child_stdin.close()
dirs = {}
fo... | StarcoderdataPython |
1797302 | <filename>_unittests/ut_datasets/test_geojson.py
# -*- coding: utf-8 -*-
"""
@brief test log(time=13s)
"""
import unittest
from bokeh.models import GeoJSONDataSource
from pyquickhelper.pycode import ExtTestCase
from papierstat.datasets import get_geojson_countries
class TestGeoJSON(ExtTestCase):
def test_ge... | StarcoderdataPython |
3354385 | #!/usr/bin/env python
__doc__ = '''
This module provides a function to write csv results to a file from the
speedtest
'''
__copyright__ = '''
MIT License
Copyright (c) 2018 bandeezy
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the ... | StarcoderdataPython |
1721779 | <reponame>brosenberg/temple-of-gelmahd
#!/usr/bin/env python
from actors import actors
from actors import player
from combat import combat
from rooms import rooms
from utils import files
from utils import utils
ACTORS = files.load_file("actors.json")
DUNGEON = files.load_file("test-dungeon.json")
ITEMS = files.load_f... | StarcoderdataPython |
1661645 | <gh_stars>0
# Copyright (c) 2019 AT&T Intellectual Property.
# Copyright (c) 2018-2019 Nokia.
#
# 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.... | StarcoderdataPython |
1723591 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui/image_dialog.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCo... | StarcoderdataPython |
1723904 | from django.conf.urls import url
from states.api.views import (
StateAPIView,
StateDetailsAPIView,
)
urlpatterns = [
url(r'^$', StateAPIView.as_view(), name='states'),
url(r'^(?P<pk>[\w.@+-]+)/$', StateDetailsAPIView.as_view(), name='state-details'),
]
| StarcoderdataPython |
1678118 | <filename>tests/st/ops/cpu/test_arithmetic_op.py<gh_stars>1-10
# Copyright 2020 Huawei Technologies Co., Ltd
#
# 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... | StarcoderdataPython |
3353793 | import os
import pytest
import time
from django.core.files.base import ContentFile
from django.core.files.storage import default_storage
from django.utils.translation import gettext as _
from pretix.presale.style import regenerate_css
from pretix.presale.style import regenerate_css
from ..utils import screenshot
@... | StarcoderdataPython |
1608912 | # -*- coding: utf-8 -*-
"""Enigma Machine Simulator.
This module is a Python implementation of the Enigma Machine.
Ran as a script it starts a simulation and allows a user to configure and use
their own Enigma Machine.
"""
import string
from time import sleep
class EnigmaMachine:
"""
A class to represent a... | StarcoderdataPython |
5194 | # -*- coding: utf-8 -*-
"""
Unit tests for the Person plugin and its model
"""
from django import forms
from django.conf import settings
from django.test import TestCase
from cms.api import add_plugin, create_page
from cmsplugin_plain_text.cms_plugins import PlaintextPlugin
from djangocms_picture.cms_plugins import Pi... | StarcoderdataPython |
3361625 | """
Using pygments to render the code.
"""
from django.utils.translation import gettext as _
from pygments import highlight, styles
from pygments.formatters.html import HtmlFormatter
from pygments.lexers import get_all_lexers, get_lexer_by_name
from pygments.styles import get_all_styles
from fluent_contents.plugins.co... | StarcoderdataPython |
63869 | ####################################
# Example AI which moves based on
# the lowest bomb location
####################################
import math
from .ai_base import AI_Base
from src.misc.game_enums import Entity
class AI_Avoid_Bomb(AI_Base):
def __init__(self):
pass
def restart(self):
pas... | StarcoderdataPython |
3258701 | <filename>ppf/core/controller.py
class controller(object):
def __init__(self, trade, model, env, historical_df = 0):
self.__trade = trade
self.__model = model
self.__env = env
self.__historical_df = historical_df
self.__symbol_table = {}
self.__event = None
def get_trade(self):
return s... | StarcoderdataPython |
4836146 | <filename>jax/_src/lax/utils.py
# Copyright 2018 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | StarcoderdataPython |
135832 | # -*- coding: utf-8 -*-
"""
Created on Wed Aug 28 11:46:55 2013
@author: Craig
"""
# standard modules
import json
import logging
import pprint
import urllib
import urllib2
# site modules
# local modules
# CONSTANTS
# CKAN structure:
# A CKAN site has a number of datasets
# Each dataset is a collection of datafil... | StarcoderdataPython |
1638065 | # Copyright 2018 The Fragpy Developers. All Rights Reserved.
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under ... | StarcoderdataPython |
1609487 | <reponame>kuanpern/jupyterlab-snippets-multimenus
expr = exp(x**2)
deriv = diff(expr, x) | StarcoderdataPython |
1740164 | <reponame>moonfruit/yysite
# -*- coding: utf-8 -*-
import os
import pickle
from abc import ABCMeta, abstractmethod
class Cache(metaclass=ABCMeta):
def __getitem__(self, key):
value = self.get(key)
if value is None:
raise KeyError
return value
def __setitem__(self, key, va... | StarcoderdataPython |
66844 | <gh_stars>10-100
#!/usr/bin/env python3
# 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
#
# http://www.apache.org/licenses/... | StarcoderdataPython |
95703 | <reponame>mattbernst/ECCE
"""
This is a small wxPython GUI for showing PMF output.
"""
import glob
import math
import optparse
import os
import signal
import wx
class PmfPanel(wx.Panel):
"""This Panel holds a listbox containing PMF data display options.
Contains a list of pmf indices, a radio button set for pi... | StarcoderdataPython |
3215864 | <reponame>pulumi-bot/pulumi-azure-native<filename>sdk/python/pulumi_azure_native/cdn/v20200901/__init__.py
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
# Export this package's modules as members:
... | StarcoderdataPython |
85793 | import math
cat1=float(input("comprimento do cateto oposto: "))
cat2=float(input("comprimento do cateteo adjacente:"))
hip= math.pow(cat1,2)+math.pow(cat2,2)
print("hipotenusa: {:.2f}".format(math.sqrt(hip))) | StarcoderdataPython |
1614642 | # Copyright 2020 Forschungszentrum Jülich GmbH and Aix-Marseille Université
# "Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements; and to You under the Apache License, Version 2.0. "
import tvb.simulator.lab as lab
from nest_elephant_tvb.Tvb.modify_tvb import Interface_c... | StarcoderdataPython |
3319649 | <filename>config/settings/local.py
import warnings
import sys
import logging
from .base import * # noqa
with warnings.catch_warnings(record=True) as warning:
environ.Env.read_env('.env')
for w in warning:
print(w.message)
DEBUG = env.bool('DJANGO_DEBUG', default=True)
TEMPLATES[0]['OPTIONS']['debug... | StarcoderdataPython |
125013 | """
@<NAME> (https://linktr.ee/pedrosantanaabreu)
@Icev (https://somosicev.com)
PT-BR:
Faça um programa que receba a quantidade de dinheiro em reais que uma pessoa que vai viajar possui.
Ela vai passar por vários países e precisa converter seu dinheiro em dólares, euros e libra esterlina.
Sabe-se que a cotarão do dóla... | StarcoderdataPython |
3320330 | # -*- coding: utf-8 -*-
# @Time : 20-4-17 上午9:55
# @File : myihome.py
from handlers.basehandler import BaseHandler
class MyIhomeHandler(BaseHandler):
def post(self, *args, **kwargs):
pass | StarcoderdataPython |
67627 | """Couple of MPyC oneliners.
Run with m parties to compute:
- m = sum_{i=0}^{m-1} 1 = sum(1 for i in range(m))
- m**2 = sum_{i=0}^{m-1} 2i+1 = sum(2*i+1 for i in range(m))
- 2**m = prod_{i=0}^{m-1} 2 = prod(2 for i in range(m))
- m! = prod_{i=0}^{m-1} i+1 = prod(i+1 for i in range(m))
B... | StarcoderdataPython |
1744253 | <filename>historian/historian.py
#!/usr/bin/env python3
from inotify import constants
from inotify.adapters import Inotify
from pyln.client import Plugin
from sqlalchemy import create_engine
from sqlalchemy import desc
from sqlalchemy.orm import sessionmaker
from threading import Thread
from common import Base, Channel... | StarcoderdataPython |
40855 | # Generated by Django 3.0.4 on 2022-03-02 19:32
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('page_edits', '0014_delete_whatsappnumber'),
]
operations = [
migrations.DeleteModel(
name='HowWeWorkText',
),
]
| StarcoderdataPython |
114144 | <gh_stars>0
# This Python file uses the following encoding: utf-8
import sys
import os
import redis
import re
class IPFilter:
def __init__(self, logFile, IPFile):
self.logFile = logFile
self.IPFile = IPFile
self.r = redis.Redis(host='localhost', port=6379, db=0)
def checkIP(self):
... | StarcoderdataPython |
105215 | <reponame>limchr/ALeFra
#!/usr/bin/env python
#
# Copyright (C) 2018
# <NAME>
# Centre of Excellence Cognitive Interaction Technology (CITEC)
# Bielefeld University
#
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# ... | StarcoderdataPython |
3232956 | #
# Copyright (c) 2020 Bitdefender
# SPDX-License-Identifier: Apache-2.0
#
import os, re, sys
def main():
out_file_path = sys.argv[1]
out_file_name = out_file_path.split('/')[-1].upper().split('.')[0]
f = open(out_file_path, 'wt')
f.write('#ifndef _%s_H_\n' % (out_file_name))
f.write('#define _%s_... | StarcoderdataPython |
3359195 | <filename>tests/classifiers/test_coding_dna_substitution.py
"""Module for testing Coding DNA Substitution Classifier."""
import unittest
from variation.classifiers import CodingDNASubstitutionClassifier
from .classifier_base import ClassifierBase
class TestCodingDNASubstitutionClassifier(ClassifierBase, unittest.Test... | StarcoderdataPython |
3316693 | <filename>tests/test_data_quality.py
# from dwetl import dw_etl
import datetime
import csv
import unittest
from dwetl import data_quality_utilities
'''
data_quality_utilities.py tests
'''
class TestDataQualityUtilities(unittest.TestCase):
#test if right exceptions are thrown when given bad data
#def test_... | StarcoderdataPython |
3208738 | <gh_stars>0
import numpy as np
import json
import os.path
import matplotlib.pyplot as plt
from os.path import join as os_join
from os.path import sep as os_sep
from source.utilities import statistics_utilities as stats_utils
caarc_freqs = [0.231, 0.429, 0.536]
# VALUES COPIED WITH FULL MATRICIES CALCULATED
eigenmode... | StarcoderdataPython |
117935 | <gh_stars>0
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
from django.contrib import messages
from django.contrib.auth.decorators import user_passes_test
from django.shortcuts import redirect, render
from django.urls import reverse
import logs.ops
from dataops import ops, pandas_db
f... | StarcoderdataPython |
3348586 | <gh_stars>0
from typing import Optional, List
from .base import Command
from ..store import Store
class Generate(Command):
def __init__(self, workspace: str, store: Store, source: dict):
super().__init__(workspace)
self.store = store
self.source = source
def execute(self):
dat... | StarcoderdataPython |
1741286 | from http.server import HTTPServer, BaseHTTPRequestHandler
import json
import sys
import datetime
DEFAULT_PAGE_FILENAME = 'index.html'
SERVER_PORT = 8080
class HTTPHoneypot(BaseHTTPRequestHandler):
def __init__(self, *args):
with open(DEFAULT_PAGE_FILENAME, 'rb') as fi:
self.default_page = fi... | StarcoderdataPython |
3228674 | import unittest
import networkx as nx
import pandas as pd
import goenrich
from goenrich.enrich import propagate
class TestPropagationExample(unittest.TestCase):
def test_correctness_on_small_example(self):
r""" Example graph
r
/ \
c1 c2
\ / \
\ ... | StarcoderdataPython |
1700518 | import torch
import torch.nn as nn
def get_network_for_size(size):
"""
Size is expected to be [channel, dim, dim]
"""
size = list(size) # In case the input is a tuple
if size[-2:] == [7, 7]:
net = ConvNet7x7
elif size[-2:] == [28, 28]:
net = ConvNet28x28
elif size[-2:] == ... | StarcoderdataPython |
1723620 | <gh_stars>1-10
#!/usr/bin/python
import docker
import sys
import os
imagename = sys.argv[1]
childname = sys.argv[2]
port = sys.argv[3]
msg = sys.argv[4]
own_dir = os.path.split(__file__)[0]
print "booting image %s with name %s listen to %s/%s" % (imagename, childname, port, msg)
container = docker.from_env().contai... | StarcoderdataPython |
1671743 | <reponame>xiayzh/MH-MDGM
import argparse
import os
import numpy as np
import itertools
from torch.utils.data import DataLoader
from torch.optim.lr_scheduler import ReduceLROnPlateau, StepLR
import torch.nn as nn
import torch.nn.functional as F
import torch
import h5py
from load_data import load_data_1scale
f... | StarcoderdataPython |
1622157 | <filename>tools/barcode_tools/helper_functions.py
#!/usr/bin/env python
# Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property right... | StarcoderdataPython |
3217745 | <reponame>JanIIISobieski/bme590hrm
def test_import():
from heart_rate import ECG
first_set = ECG(filename='test_data1.csv')
assert first_set.time[0] == 0
assert first_set.time[-1] == 27.775
assert first_set.voltage[0] == -0.145
assert first_set.voltage[-1] == 0.72
second_set = ECG(filename... | StarcoderdataPython |
46367 | from django.contrib import admin
from django.urls import path
# from django.contrib.auth.decorators import login_required
# from rest_framework.urlpatterns import format_suffix_patterns
from . views import *
urlpatterns = [
# path('admin/', admin.site.urls),
path('', main_view, name='main_view'),
]
| StarcoderdataPython |
1665502 | from torch.distributed._sharding_spec import (
ChunkShardingSpec,
)
def generate_chunk_sharding_specs_for_test(sharding_dim):
return [
ChunkShardingSpec(
dim=sharding_dim,
placements=[
"rank:0/cuda:0",
"rank:1/cuda:1",
"rank:2/cuda... | StarcoderdataPython |
1773406 | # -*- coding: utf-8 -*-
from __future__ import division, absolute_import, print_function, unicode_literals
from unittest import TestCase
class TestBasic():
def nop(self):
pass
| StarcoderdataPython |
3239806 | <filename>apps/users/migrations/0001_initial.py<gh_stars>0
# Generated by Django 4.0 on 2022-01-28 11:17
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0012_alter_user_first_name_max_length')... | StarcoderdataPython |
1666639 | #! /usr/bin/env python
from distutils.core import setup, Extension
import os
import sys
pwd = os.getcwd()
project_top_dir = os.getenv('PROJECT_TOP_DIR')
if project_top_dir is None:
project_top_dir = os.path.join(pwd, '/../')
include_dir = os.path.join( project_top_dir, 'include' )
src_python_dir = os.path.join... | StarcoderdataPython |
1673467 | from setuptools import setup
import os
VERSION = "2.0"
def get_long_description():
with open(
os.path.join(os.path.dirname(os.path.abspath(__file__)), "README.md"),
encoding="utf8",
) as fp:
return fp.read()
setup(
name="datasette-render-markdown",
description="Datasette plu... | StarcoderdataPython |
1747512 | <filename>python/tvm/topi/testing/reorg_python.py<gh_stars>1000+
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under... | StarcoderdataPython |
1616595 | import json
import typing
from flask import Response as FlaskResponse
from cauldron import environ
from cauldron.cli import server
Responses = typing.NamedTuple('TestResponses', [
('flask', FlaskResponse),
('response', 'environ.Response')
])
def create_test_app():
"""..."""
return server.server_ru... | StarcoderdataPython |
3350075 | <reponame>EllaDing/nlp-with-deep-learning
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
CS224N 2019-20: Homework 5
"""
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
class Highway(nn.Module):
# Remember to delete the above 'pass' after your implementation
### YOUR ... | StarcoderdataPython |
1786366 | import os
import sys
import zipfile
import django
import zookeeper
sys.path.append("/var/projects/museum/")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "museum.settings")
django.setup()
from museum_site.models import File
def main():
files = File.objects.all().order_by("letter", "title")
z = zookeeper.... | StarcoderdataPython |
141350 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: luisgasco
Script to generate a terminology tsv file with concepts of SnomedCT given a list of seed codes.
You will get the concept
to normaliza clinical entities to controlled vocabularies
"""
import sys
import pandas as pd
import networkx as nx
import numpy... | StarcoderdataPython |
1784498 | <reponame>Zhenye-Na/LxxxCode<gh_stars>10-100
class ListNode:
def __init__(self, key, val, next=None, prev=None):
self.key = key
self.val = val
self.next = next
self.prev = prev
class LRUCache:
def __init__(self, capacity: int):
self.cache_history = {}
self.head... | StarcoderdataPython |
3278634 | # -*- coding: UTF-8 -*-
from unittest import TestCase
class TestVtk(TestCase):
def test_ust_from_blk(self):
from nose.plugins.skip import SkipTest
try:
import vtk
except ImportError:
raise SkipTest
from ..testing import get_blk_from_sample_neu
from ... | StarcoderdataPython |
1651288 | from uio import FileIO
from component import Component, components
class FileSystem:
def __init__(self, address):
self.fs = Component(address, components()[address])
self.address = address
self.readonly = self.fs.isReadOnly()
self.cwd = "/"
# noinspection PyUnusedLocal
de... | StarcoderdataPython |
135041 | import torch
from torch import nn
rnn_units = 128
class Model(nn.Module):
def __init__(self, column_units):
super(Model, self).__init__()
self.cnn = nn.Sequential(
nn.Conv2d(3, 16, kernel_size=3, stride=1, padding=1),
nn.BatchNorm2d(16),
nn.ReLU(inplace=True),
... | StarcoderdataPython |
3261943 | # Guessing game
# What does it do?
# We'll write a program that plays a guessing game with a user
# Would be useful to have the program print out the rules at the beginning
# How does the user communicate to the program that the program didn't guess the right number?
# We can have the user specify that the program's g... | StarcoderdataPython |
47015 | <gh_stars>1-10
import os
import re
import json
import argparse
import random
import numpy as np
import torch
import experiments.experiment_langid as experiment_lid
import experiments.experiment_ner as experiment_ner
import experiments.experiment_pos as experiment_pos
from types import SimpleNamespace as Namespace
PR... | StarcoderdataPython |
1696994 | <gh_stars>1-10
import atexit
import unittest
from pact import Consumer, Provider
from consumer import user
pact = Consumer('Consumer').has_pact_with(Provider('Provider'))
pact.start_service()
atexit.register(pact.stop_service)
class ContractTest(unittest.TestCase):
def test_first(self):
expected = {'h... | StarcoderdataPython |
116030 | <reponame>smpenna3/traffic<filename>main.py<gh_stars>0
from flask import Flask, render_template, request, Response
import logging
import traceback
import datetime as dt
import json
from traffic_lights import TrafficLights
# Setup logging
logger = logging.getLogger('mainLog')
logger.setLevel(logging.DEBUG)
fh = loggin... | StarcoderdataPython |
1745762 | import torch
from pprint import pprint
import config
from utils.manager import PathManager
from model import *
def buildModel(path_manager: PathManager,
task_config=None,
model_params: config.ParamsConfig = None,
loss_func=None,
data_source=None,):
if m... | StarcoderdataPython |
3215461 | <reponame>Learn-code-strategies/DEXBot<gh_stars>0
"""
A module to provide an interactive text-based tool for dexbot configuration
The result is dexbot can be run without having to hand-edit config files.
If systemd is detected it will offer to install a user service unit (under ~/.local/share/systemd)
This requires a p... | StarcoderdataPython |
3224222 | <filename>api/tests/integration/tests/basic/radicals.py
import os
import sys
sys.path.append(
os.path.normpath(
os.path.join(os.path.abspath(__file__), "..", "..", "..", "common")
)
)
from env_indigo import *
indigo = Indigo()
indigo.setOption("molfile-saving-skip-date", "1")
print("****** Basic ****... | StarcoderdataPython |
127422 | <reponame>F1ashhimself/ui-map-parser<filename>tests/test_parser.py<gh_stars>0
# -*- coding: utf-8 -*-
__author__ = '<EMAIL>'
import pytest
from hamcrest import assert_that, equal_to, raises
from ui_map_parser import UIMapException
def test_simple_element(ui_map_parser):
selector_type, selector = ui_map_parser... | StarcoderdataPython |
3355599 | # -*- coding: utf-8 -*-
from decimal import Decimal
def parse_coverage_report(string):
lines = string.splitlines()[1:] # Skip cover mode def.
statements = len(lines)
covered = sum([line.split()[-1] != '0' and 1 or 0 for line in lines])
return float(round(Decimal(float(covered) / float(statements)) * ... | StarcoderdataPython |
3275177 | <filename>jams/esat.py
#!/usr/bin/env python
"""
esat : Saturation vapour pressure of water and ice.
This module was written by <NAME> while at Department of
Computational Hydrosystems, Helmholtz Centre for Environmental
Research - UFZ, Leipzig, Germany, and continued while at Institut
National de Recherche pour l'Agr... | StarcoderdataPython |
125942 | <filename>venv/Lib/site-packages/formtools/__init__.py
__version__ = '2.0'
default_app_config = 'formtools.apps.FormToolsConfig'
| StarcoderdataPython |
3230575 | <reponame>GiannisVagionakis/metrics
# Copyright The PyTorch Lightning team.
#
# 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 requi... | StarcoderdataPython |
1712734 | # blender modules
import bpy
# addon modules
from . import gl_utils
from . import gpu_utils
from . import settings
from .. import version_utils
def draw_cube(half_size_x, half_size_y, half_size_z, color=None):
if version_utils.IS_28:
gpu_utils.draw_wire_cube(half_size_x, half_size_y, half_size_z, color)
... | StarcoderdataPython |
1765486 | <reponame>watacool/lyrics_analysis<gh_stars>0
# coding: utf-8
# python 2.7
import os
import argparse
import pandas as pd
from download_lyrics import make_dataset
from janome.tokenizer import Tokenizer # $ pip install janome
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument("--ini... | StarcoderdataPython |
3335362 | <reponame>nimzco/Environment
# -*- coding: utf-8 -*-
import os
import platform
import fnmatch
from re import match, sub
from subprocess import PIPE
from subprocess import Popen
import sublime
import sublime_plugin
#
# Monkey patch `sublime.Region` so it can be iterable:
sublime.Region.totuple = lambda self: (self.a... | StarcoderdataPython |
1784915 | '''if conditions:
do_action_1
...
do_action_n'''
# Statement if
x = 4
if x % 2 ==0: # jika sisa bagi x dengan 2 sama dengan 0
print("x habis dibagi dua") # statemen aksi lebih menjorok ke dalam
# Statement if ... elif ... else
x = 7
if x % 2 ==0: # jika sisa bagi x dengan 2 sama dengan 0
print("x h... | StarcoderdataPython |
3268870 | <gh_stars>10-100
# vim: set ts=8 sts=2 sw=2 tw=99 et:
#
# This file is part of AMBuild.
#
# AMBuild is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any la... | StarcoderdataPython |
1707725 | <filename>virtual_box_tools/windows_password_database.py
import ctypes
def getpwnam(user: str):
get_user_name = ctypes.windll.secur32.GetUserNameExW
display_name = 3
size = ctypes.pointer(ctypes.c_ulong(0))
get_user_name(display_name, None, size)
name_buffer = ctypes.create_unicode_buffer(size.con... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.